Inter prediction method and apparatus in image/video coding system

ABSTRACT

A video decoding method performed by a video decoding apparatus, according to the present document, comprises the steps of: parsing, from a bitstream, flags associated with weighted prediction; parsing a prediction weighted table syntax from a picture header of the bitstream on the basis of the flags; generating prediction samples regarding a current block in a current picture on the basis of syntax elements in the prediction weighted table syntax; and generating reconstructed samples on the basis of the prediction samples, wherein the flags comprise a first flag associated with whether the weighted prediction is applied to slices referring to a picture parameter set of the bitstream, and a second flag associated with whether information related to the weighted prediction is present in the picture header, and the second flag may be parsed from the picture parameter set on the basis of the first flag.

CROSS-REFERENCE TO RELATED APPLICATIONS

Pursuant to 35 U.S.C. § 119(e), this application is a continuation ofInternational Application PCT/KR2021/000467, with an internationalfiling date of Jan. 13, 2021, which claims the benefit of U.S.Provisional Patent Application No. 62/960,651, filed on Jan. 13, 2020,the contents of which are hereby incorporated by reference herein intheir entirety.

BACKGROUND Technical Field

The present disclosure relates to a method and an apparatus forperforming inter prediction when encoding/decoding image/videoinformation in an image/video coding system.

Related Art

Recently, the demand for high resolution, high quality image/video suchas 4K, 8K or more Ultra High Definition (UHD) image/video is increasingin various fields. As the image/video resolution or quality becomeshigher, relatively more amount of information or bits are transmittedthan for conventional image/video data. Therefore, if image/video dataare transmitted via a medium such as an existing wired/wirelessbroadband line or stored in a legacy storage medium, costs fortransmission and storage are readily increased.

Moreover, interests and demand are growing for virtual reality (VR) andartificial reality (AR) contents, and immersive media such as hologram;and broadcasting of images/videos exhibiting image/video characteristicsdifferent from those of an actual image/video, such as gameimages/videos, are also growing.

Therefore, a highly efficient image/video compression technique isrequired to effectively compress and transmit, store, or play highresolution, high quality images/videos showing various characteristicsas described above.

SUMMARY

A technical subject of the present document is to provide a method andan apparatus for enhancing efficiency in video/image coding.

Another technical subject of the present document is to provide a methodand an apparatus for efficiently performing inter prediction.

Still another technical subject of the present document is to provide amethod and an apparatus for efficiently signaling a prediction weightedtable syntax when performing inter prediction based on weightedprediction.

Yet another technical subject of the present document is to provide amethod and an apparatus for reducing signaling overhead with respect toweighted prediction.

Still another technical subject of the present document is to provide amethod and an apparatus for reducing the amount of bits used forweighted prediction.

According to an embodiment of the present document, a video decodingmethod performed by a video decoding apparatus may include parsing flagsrelating to weighted prediction from a bitstream, parsing a predictionweighted table syntax from a picture header of the bitstream based onthe flags, generating prediction samples for a current block in acurrent picture based on syntax elements in the prediction weightedtable syntax, and generating reconstructed samples based on theprediction samples, wherein the flags may include a first flag relatingto whether the weighted prediction is applied to slices referring to apicture parameter set of the bitstream and a second flag relating towhether information on the weighted prediction exists in the pictureheader, and the second flag may be parsed from the picture parameter setbased on the first flag.

According to another embodiment of the present document, a videoencoding method performed by a video encoding apparatus may includegenerating prediction samples for a current block by performing weightedprediction based on motion information on the current block in a currentpicture, generating residual information based on the prediction samplesand original samples of the current picture, and encoding imageinformation including information on the weighted prediction and theresidual information, wherein the information on the weighted predictionmay include flags relating to the weighted prediction and a predictionweighted table syntax, the flags may include a first flag relating towhether the weighted prediction is applied to slices referring to apicture parameter set of the image information and a second flagrelating to whether the information on the weighted prediction exists ina picture header of the image information, the second flag may beincluded in the picture parameter set based on the first flag, and theprediction weighted table syntax may be included in the picture headerbased on the flags.

According to still another embodiment of the present document, acomputer-readable digital storage medium may include information tocause a video decoding apparatus to perform a video decoding method, andthe video decoding method may include parsing flags relating to weightedprediction from image information, parsing a prediction weighted tablesyntax from a picture header of the image information based on theflags, generating prediction samples for a current block in a currentpicture based on syntax elements in the prediction weighted tablesyntax, and generating reconstructed samples based on the predictionsamples, wherein the flags may include a first flag relating to whetherthe weighted prediction is applied to slices referring to a pictureparameter set of the image information and a second flag relating towhether information on the weighted prediction exists in the pictureheader, and the second flag may be parsed from the picture parameter setbased on the first flag.

According to an embodiment of the present document, it is possible toenhance overall video/image compression efficiency.

According to an embodiment of the present document, it is possible toefficiently perform inter prediction.

According to an embodiment of the present document, it is possible toefficiently signal a prediction weighted table syntax.

According to an embodiment of the present document, it is possible toreduce redundant signaling in transmitting information on weightedprediction.

According to an embodiment of the present document, it is possible toreduce the amount of bits used for weighted prediction.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 schematically illustrates an example of a video/image codingsystem to which embodiments of the present document are applicable.

FIG. 2 is a diagram schematically illustrating a configuration of avideo/image encoding apparatus to which the embodiments of the presentdocument are applicable.

FIG. 3 is a diagram schematically illustrating a configuration of avideo/image decoding apparatus to which the embodiments of the presentdocument are applicable.

FIG. 4 illustrates a hierarchical structure of a coded image/video.

FIG. 5 illustrates an example of an inter prediction-based video/imageencoding method.

FIG. 6 schematically illustrates an inter predictor in an encodingapparatus.

FIG. 7 illustrates an example of an inter prediction-based video/imagedecoding method.

FIG. 8 schematically illustrates an inter predictor in a decodingapparatus.

FIG. 9 and FIG. 10 schematically illustrate an example of a video/imageencoding method and related components according to an embodiment of thepresent document.

FIG. 11 and FIG. 12 schematically illustrate an example of a video/imagedecoding method and related components according to an embodiment of thepresent document.

FIG. 13 illustrates an example of a content streaming system to whichembodiments disclosed in the present document are applicable.

DESCRIPTION OF EXEMPLARY EMBODIMENTS

The disclosure of the present document may be modified in various forms,and specific embodiments thereof will be described and illustrated inthe drawings. The terms used in the present document are used to merelydescribe specific embodiments, but are not intended to limit thedisclosed method in the present document. An expression of a singularnumber includes an expression of ‘at least one’, so long as it isclearly read differently. The terms such as “include” and “have” areintended to indicate that features, numbers, steps, operations,elements, components, or combinations thereof used in the document existand it should be thus understood that the possibility of existence oraddition of one or more different features, numbers, steps, operations,elements, components, or combinations thereof is not excluded.

The present document relates to video/image coding. For example, amethod/embodiment disclosed in the present document may be applied to amethod disclosed in a versatile video coding (VVC) standard. Inaddition, the method/embodiment disclosed in the present document may beapplied to a method disclosed in an essential video coding (EVC)standard, AOMedia Video 1 (AV1) standard, 2nd generation of audio videocoding standard (AVS2), or a next-generation video/image coding standard(e.g., H.267, H.268, etc.).

Various embodiments related to video/image coding are presented in thepresent document, and the embodiments may be combined with each otherunless otherwise stated.

In addition, each configuration of the drawings described in the presentdocument is an independent illustration for explaining functions asfeatures that are different from each other, and does not mean that eachconfiguration is implemented by mutually different hardware or differentsoftware. For example, two or more of the configurations may be combinedto form one configuration, and one configuration may also be dividedinto multiple configurations. Without departing from the gist of thedisclosed method of the present document, embodiments in whichconfigurations are combined and/or separated are included in the scopeof the disclosure of the present document.

In the present document, the term “/” and “,” should be interpreted toindicate “and/or.” For instance, the expression “A/B” may mean “A and/orB.” Further, “A, B” may mean “A and/or B.” Further, “A/B/C” may mean “atleast one of A, B, and/or C.” Also, “A/B/C” may mean “at least one of A,B, and/or C.”

Further, in the document, the term “or” should be interpreted toindicate “and/or.” For instance, the expression “A or B” may comprise 1)only A, 2) only B, and/or 3) both A and B. In other words, the term “or”in the present document should be interpreted to indicate “additionallyor alternatively.”

Further, the parentheses used in the present document may mean “forexample”. Specifically, in case that “prediction (intra prediction)” isexpressed, it may be indicated that “intra prediction” is proposed as anexample of “prediction”. In other words, the term “prediction” in thepresent document is not limited to “intra prediction”, and “intraprediction” is proposed as an example of “prediction”. Further, even incase that “prediction (i.e., intra prediction)” is expressed, it may beindicated that “intra prediction” is proposed as an example of“prediction”.

In the present document, technical features individually explained inone drawing may be individually implemented or simultaneouslyimplemented.

Hereinafter, embodiments of the present document will be described indetail with reference to the accompanying drawings. In addition, likereference numerals are used to indicate like elements throughout thedrawings, and the same descriptions on the like elements may be omitted.

FIG. 1 illustrates an example of a video/image coding system to whichthe embodiments of the present document may be applied.

Referring to FIG. 1 , a video/image coding system may include a firstdevice (a source device) and a second device (a reception device). Thesource device may transmit encoded video/image information or data tothe reception device through a digital storage medium or network in theform of a file or streaming.

The source device may include a video source, an encoding apparatus, anda transmitter. The receiving device may include a receiver, a decodingapparatus, and a renderer. The encoding apparatus may be called avideo/image encoding apparatus, and the decoding apparatus may be calleda video/image decoding apparatus. The transmitter may be included in theencoding apparatus. The receiver may be included in the decodingapparatus. The renderer may include a display, and the display may beconfigured as a separate device or an external component.

The video source may acquire video/image through a process of capturing,synthesizing, or generating the video/image. The video source mayinclude a video/image capture device and/or a video/image generatingdevice. The video/image capture device may include, for example, one ormore cameras, video/image archives including previously capturedvideo/images, and the like. The video/image generating device mayinclude, for example, computers, tablets and smartphones, and may(electronically) generate video/images. For example, a virtualvideo/image may be generated through a computer or the like. In thiscase, the video/image capturing process may be replaced by a process ofgenerating related data.

The encoding apparatus may encode input video/image. The encodingapparatus may perform a series of procedures such as prediction,transform, and quantization for compaction and coding efficiency. Theencoded data (encoded video/image information) may be output in the formof a bitstream.

The transmitter may transmit the encoded image/image information or dataoutput in the form of a bitstream to the receiver of the receivingdevice through a digital storage medium or a network in the form of afile or streaming. The digital storage medium may include variousstorage mediums such as USB, SD, CD, DVD, Blu-ray, HDD, SSD, and thelike. The transmitter may include an element for generating a media filethrough a predetermined file format and may include an element fortransmission through a broadcast/communication network. The receiver mayreceive/extract the bitstream and transmit the received bitstream to thedecoding apparatus.

The decoding apparatus may decode the video/image by performing a seriesof procedures such as dequantization, inverse transform, and predictioncorresponding to the operation of the encoding apparatus.

The renderer may render the decoded video/image. The renderedvideo/image may be displayed through the display.

In the present document, a video may refer to a series of images overtime. A picture generally refers to the unit representing one image at aparticular time frame, and a slice/tile refers to the unit constitutinga part of the picture in terms of coding. A slice/tile may include oneor more coding tree units (CTUs). One picture may consist of one or moreslices/tiles. One picture may consist of one or more tile groups. Onetile group may include one or more tiles. A brick may represent arectangular region of CTU rows within a tile in a picture). A tile maybe partitioned into multiple bricks, each of which consisting of one ormore CTU rows within the tile. A tile that is not partitioned intomultiple bricks may be also referred to as a brick. A brick scan is aspecific sequential ordering of CTUs partitioning a picture in which theCTUs are ordered consecutively in CTU raster scan in a brick, brickswithin a tile are ordered consecutively in a raster scan of the bricksof the tile, and tiles in a picture are ordered consecutively in araster scan of the tiles of the picture. A tile is a rectangular regionof CTUs within a particular tile column and a particular tile row in apicture. The tile column is a rectangular region of CTUs having a heightequal to the height of the picture and a width specified by syntaxelements in the picture parameter set. The tile row is a rectangularregion of CTUs having a height specified by syntax elements in thepicture parameter set and a width equal to the width of the picture). Atile scan is a specific sequential ordering of CTUs partitioning apicture in which the CTUs are ordered consecutively in CTU raster scanin a tile whereas tiles in a picture are ordered consecutively in araster scan of the tiles of the picture. A slice includes an integernumber of bricks of a picture that may be exclusively contained in asingle NAL unit. A slice may consist of either a number of completetiles or only a consecutive sequence of complete bricks of one tile. Inthe present document, tile group and slice may be used interchangeably.For example, in the present document, a tile group/tile group header maybe referred to as a slice/slice header.

A pixel or a pel may mean a smallest unit constituting one picture (orimage). Also, ‘sample’ may be used as a term corresponding to a pixel. Asample may generally represent a pixel or a value of a pixel, and mayrepresent only a pixel/pixel value of a luma component or only apixel/pixel value of a chroma component.

A unit may represent a basic unit of image processing. The unit mayinclude at least one of a specific region of the picture and informationrelated to the region. One unit may include one luma block and twochroma (ex. Cb, cr) blocks. The unit may be used interchangeably withterms such as block or area in some cases. In a general case, an M×Nblock may include samples (or sample arrays) or a set (or array) oftransform coefficients of M columns and N rows. Alternatively, thesample may mean a pixel value in the spatial domain, and when such apixel value is transformed to the frequency domain, it may mean atransform coefficient in the frequency domain.

The unit may be interchangeably used with the term such as a block or anarea in some cases. Generally, an M×N block may represent samplescomposed of M columns and N rows or a group of transform coefficients.The sample may generally represent a pixel or a value of the pixel, andmay also represent only the pixel/pixel value of a luma component, andalso represent only the pixel/pixel value of a chroma component. Thesample may be used as the term corresponding to a pixel or a pelconfiguring one picture (or image).

FIG. 2 is a diagram schematically illustrating the configuration of avideo/image encoding apparatus to which the embodiments of the presentdocument may be applied. Hereinafter, what is referred to as the videoencoding apparatus may include an image encoding apparatus.

Referring to FIG. 2 , the encoding apparatus 200 may include and beconfigured with an image partitioner 210, a predictor 220, a residualprocessor 230, an entropy encoder 240, an adder 250, a filter 260, and amemory 270. The predictor 220 may include an inter predictor 221 and anintra predictor 222. The residual processor 230 may include atransformer 232, a quantizer 233, a dequantizer 234, and an inversetransformer 235. The residual processor 230 may further include asubtractor 231. The adder 250 may be called a reconstructor orreconstructed block generator. The image partitioner 210, the predictor220, the residual processor 230, the entropy encoder 240, the adder 250,and the filter 260, which have been described above, may be configuredby one or more hardware components (e.g., encoder chipsets orprocessors) according to an embodiment. In addition, the memory 270 mayinclude a decoded picture buffer (DPB), and may also be configured by adigital storage medium. The hardware component may further include thememory 270 as an internal/external component.

The image partitioner 210 may split an input image (or, picture, frame)input to the encoding apparatus 200 into one or more processing units.As an example, the processing unit may be called a coding unit (CU). Inthis case, the coding unit may be recursively split according to aQuad-tree binary-tree ternary-tree (QTBTTT) structure from a coding treeunit (CTU) or the largest coding unit (LCU). For example, one codingunit may be split into a plurality of coding units of a deeper depthbased on a quad-tree structure, a binary-tree structure, and/or aternary-tree structure. In this case, for example, the quad-treestructure is first applied and the binary-tree structure and/or theternary-tree structure may be later applied. Alternatively, thebinary-tree structure may also be first applied. A coding procedureaccording to the present document may be performed based on a finalcoding unit which is not split any more. In this case, based on codingefficiency according to image characteristics or the like, the maximumcoding unit may be directly used as the final coding unit, or asnecessary, the coding unit may be recursively split into coding units ofa deeper depth, such that a coding unit having an optimal size may beused as the final coding unit. Here, the coding procedure may include aprocedure such as prediction, transform, and reconstruction to bedescribed later. In another example, the processing unit may furtherinclude a prediction unit (PU) or a transform unit (TU). In this case,each of the prediction unit and the transform unit may be split orpartitioned from the aforementioned final coding unit. The predictionunit may be a unit of sample prediction, and the transform unit may be aunit for inducing a transform coefficient and/or a unit for inducing aresidual signal from the transform coefficient.

The encoding apparatus 200 may subtract the prediction signal (predictedblock, prediction sample array) output from the inter predictor 221 orthe intra predictor 222 from the input image signal (original block,original sample array) to generate a residual signal (residual block,residual sample array), and the generated residual signal is transmittedto the transformer 232. In this case, as illustrated, a unit forsubtracting the prediction signal (prediction block, prediction samplearray) from an input image signal (original block, original samplearray) in the encoder 200 may be referred to as a subtractor 231. Thepredictor 220 may perform prediction on a processing target block(hereinafter, referred to as a current block) and generate a predictedblock including prediction samples for the current block. The predictor220 may determine whether intra prediction or inter prediction isapplied in units of a current block or CU. The predictor 220 maygenerate various kinds of information on prediction, such as predictionmode information, and transmit the generated information to the entropyencoder 240, as is described below in the description of each predictionmode. The information on prediction may be encoded by the entropyencoder 240 and output in the form of a bitstream.

The intra predictor 222 may predict a current block with reference tosamples within a current picture. The referenced samples may be locatedneighboring to the current block, or may also be located away from thecurrent block according to the prediction mode. The prediction modes inthe intra prediction may include a plurality of non-directional modesand a plurality of directional modes. The non-directional mode mayinclude, for example, a DC mode or a planar mode. The directional modemay include, for example, 33 directional prediction modes or 65directional prediction modes according to the fine degree of theprediction direction. However, this is illustrative and the directionalprediction modes which are more or less than the above number may beused according to the setting. The intra predictor 222 may alsodetermine the prediction mode applied to the current block using theprediction mode applied to the neighboring block.

The inter predictor 221 may induce a predicted block of the currentblock based on a reference block (reference sample array) specified by amotion vector on a reference picture. At this time, in order to decreasethe amount of motion information transmitted in the inter predictionmode, the motion information may be predicted in units of a block, asub-block, or a sample based on the correlation of the motioninformation between the neighboring block and the current block. Themotion information may include a motion vector and a reference pictureindex. The motion information may further include inter predictiondirection (L0 prediction, L1 prediction, Bi prediction, or the like)information. In the case of the inter prediction, the neighboring blockmay include a spatial neighboring block existing within the currentpicture and a temporal neighboring block existing in the referencepicture. The reference picture including the reference block and thereference picture including the temporal neighboring block may also bethe same as each other, and may also be different from each other. Thetemporal neighboring block may be called the name such as a collocatedreference block, a collocated CU (colCU), or the like, and the referencepicture including the temporal neighboring block may also be called acollocated picture (colPic). For example, the inter predictor 221 mayconfigure a motion information candidate list based on the neighboringblocks, and generate information indicating what candidate is used toderive the motion vector and/or the reference picture index of thecurrent block. The inter prediction may be performed based on variousprediction modes, and for example, in the case of a skip mode and amerge mode, the inter predictor 221 may use the motion information ofthe neighboring block as the motion information of the current block. Inthe case of the skip mode, the residual signal may not be transmittedunlike the merge mode. A motion vector prediction (MVP) mode mayindicate the motion vector of the current block by using the motionvector of the neighboring block as a motion vector predictor, andsignaling a motion vector difference.

The predictor 220 may generate a prediction signal based on variousprediction methods to be described below. For example, the predictor 220may apply intra prediction or inter prediction for prediction of oneblock and may simultaneously apply intra prediction and interprediction. This may be called combined inter and intra prediction(CIIP). In addition, the predictor may be based on an intra block copy(IBC) prediction mode or based on a palette mode for prediction of ablock. The IBC prediction mode or the palette mode may be used forimage/video coding of content such as games, for example, screen contentcoding (SCC). IBC basically performs prediction within the currentpicture, but may be performed similarly to inter prediction in that areference block is derived within the current picture. That is, IBC mayuse at least one of the inter prediction techniques described in thepresent document. The palette mode may be viewed as an example of intracoding or intra prediction. When the palette mode is applied, a samplevalue in the picture may be signaled based on information on the palettetable and the palette index.

The prediction signal generated by the predictor (including the interpredictor 221 and/or the intra predictor 222) may be used to generate areconstructed signal or may be used to generate a residual signal.

The transformer 232 may generate transform coefficients by applying atransform technique to the residual signal. For example, the transformtechnique may include at least one of a discrete cosine transform (DCT),a discrete sine transform (DST), a graph-based transform (GBT), or aconditionally non-linear transform (CNT). Here, GBT refers totransformation obtained from a graph when expressing relationshipinformation between pixels in the graph. CNT refers to transformationobtained based on a prediction signal generated using all previouslyreconstructed pixels. Also, the transformation process may be applied toa block of pixels having the same size as a square or may be applied toa block of a variable size that is not a square.

The quantizer 233 quantizes the transform coefficients and transmits thesame to the entropy encoder 240, and the entropy encoder 240 encodes thequantized signal (information on the quantized transform coefficients)and outputs the encoded signal as a bitstream. Information on thequantized transform coefficients may be referred to as residualinformation. The quantizer 233 may rearrange the quantized transformcoefficients in the block form into a one-dimensional vector form basedon a coefficient scan order and may generate information on thetransform coefficients based on the quantized transform coefficients inthe one-dimensional vector form.

The entropy encoder 240 may perform various encoding methods such as,for example, exponential Golomb, context-adaptive variable length coding(CAVLC), and context-adaptive binary arithmetic coding (CABAC). Theentropy encoder 240 may encode information necessary for video/imagereconstruction (e.g., values of syntax elements, etc.) other than thequantized transform coefficients together or separately. Encodedinformation (e.g., encoded video/image information) may be transmittedor stored in units of a network abstraction layer (NAL) unit in the formof a bitstream. The video/image information may further includeinformation on various parameter sets, such as an adaptation parameterset (APS), a picture parameter set (PPS), a sequence parameter set(SPS), or a video parameter set (VPS). Also, the video/image informationmay further include general constraint information. In the presentdocument, information and/or syntax elements transmitted/signaled fromthe encoding apparatus to the decoding apparatus may be included invideo/image information. The video/image information may be encodedthrough the encoding procedure described above and included in thebitstream. The bitstream may be transmitted through a network or may bestored in a digital storage medium. Here, the network may include abroadcasting network and/or a communication network, and the digitalstorage medium may include various storage media such as USB, SD, CD,DVD, Blu-ray, HDD, and SSD. A transmitting unit (not shown) and/or astoring unit (not shown) for transmitting or storing a signal outputfrom the entropy encoder 240 may be configured as internal/externalelements of the encoding apparatus 200, or the transmitting unit may beincluded in the entropy encoder 240.

The quantized transform coefficients output from the quantizer 233 maybe used to generate a prediction signal. For example, the residualsignal (residual block or residual samples) may be reconstructed byapplying dequantization and inverse transform to the quantized transformcoefficients through the dequantizer 234 and the inverse transform unit235. The adder 250 may add the reconstructed residual signal to theprediction signal output from the inter predictor 221 or the intrapredictor 222 to generate a reconstructed signal (reconstructed picture,reconstructed block, reconstructed sample array). When there is noresidual for the processing target block, such as when the skip mode isapplied, the predicted block may be used as a reconstructed block. Theadder 250 may be referred to as a restoration unit or a restorationblock generator. The generated reconstructed signal may be used forintra prediction of a next processing target block in the currentpicture, or may be used for inter prediction of the next picture afterbeing filtered as described below.

Meanwhile, luma mapping with chroma scaling (LMCS) may be applied duringa picture encoding and/or reconstruction process.

The filter 260 may improve subjective/objective image quality byapplying filtering to the reconstructed signal. For example, the filter260 may generate a modified reconstructed picture by applying variousfiltering methods to the reconstructed picture, and store the modifiedreconstructed picture in the memory 270, specifically, in a DPB of thememory 270. The various filtering methods may include, for example,deblocking filtering, a sample adaptive offset, an adaptive loop filter,a bilateral filter, and the like. The filter 260 may generate variouskinds of information related to the filtering, and transfer thegenerated information to the entropy encoder 240 as described later inthe description of each filtering method. The information related to thefiltering may be encoded by the entropy encoder 240 and output in theform of a bitstream.

The modified reconstructed picture transmitted to the memory 270 may beused as a reference picture in the inter predictor 221. When the interprediction is applied through the encoding apparatus, predictionmismatch between the encoding apparatus 200 and the decoding apparatusmay be avoided and encoding efficiency may be improved.

The DPB of the memory 270 may store the modified reconstructed picturefor use as the reference picture in the inter predictor 221. The memory270 may store motion information of a block from which the motioninformation in the current picture is derived (or encoded) and/or motioninformation of blocks in the picture, having already been reconstructed.The stored motion information may be transferred to the inter predictor221 to be utilized as motion information of the spatial neighboringblock or motion information of the temporal neighboring block. Thememory 270 may store reconstructed samples of reconstructed blocks inthe current picture, and may transfer the reconstructed samples to theintra predictor 222.

FIG. 3 is a diagram for schematically explaining the configuration of avideo/image decoding apparatus to which the embodiments of the presentdocument may be applied.

Referring to FIG. 3 , the decoding apparatus 300 may include andconfigured with an entropy decoder 310, a residual processor 320, apredictor 330, an adder 340, a filter 350, and a memory 360. Thepredictor 330 may include an inter predictor 331 and an intra predictor332. The residual processor 320 may include a dequantizer 321 and aninverse transformer 322. The entropy decoder 310, the residual processor320, the predictor 330, the adder 340, and the filter 350, which havebeen described above, may be configured by one or more hardwarecomponents (e.g., decoder chipsets or processors) according to anembodiment. Further, the memory 360 may include a decoded picture buffer(DPB), and may be configured by a digital storage medium. The hardwarecomponent may further include the memory 360 as an internal/externalcomponent.

When the bitstream including the video/image information is input, thedecoding apparatus 300 may reconstruct the image in response to aprocess in which the video/image information is processed in theencoding apparatus illustrated in FIG. 2 . For example, the decodingapparatus 300 may derive the units/blocks based on block split-relatedinformation acquired from the bitstream. The decoding apparatus 300 mayperform decoding using the processing unit applied to the encodingapparatus. Therefore, the processing unit for the decoding may be, forexample, a coding unit, and the coding unit may be split according tothe quad-tree structure, the binary-tree structure, and/or theternary-tree structure from the coding tree unit or the maximum codingunit. One or more transform units may be derived from the coding unit.In addition, the reconstructed image signal decoded and output throughthe decoding apparatus 300 may be reproduced through a reproducingapparatus.

The decoding apparatus 300 may receive a signal output from the encodingapparatus of FIG. 2 in the form of a bitstream, and the received signalmay be decoded through the entropy decoder 310. For example, the entropydecoder 310 may parse the bitstream to derive information (e.g.,video/image information) necessary for image reconstruction (or picturereconstruction). The video/image information may further includeinformation on various parameter sets such as an adaptation parameterset (APS), a picture parameter set (PPS), a sequence parameter set(SPS), or a video parameter set (VPS). In addition, the video/imageinformation may further include general constraint information. Thedecoding apparatus may further decode picture based on the informationon the parameter set and/or the general constraint information.Signaled/received information and/or syntax elements described later inthe present document may be decoded may decode the decoding procedureand obtained from the bitstream. For example, the entropy decoder 310decodes the information in the bitstream based on a coding method suchas exponential Golomb coding, context-adaptive variable length coding(CAVLC), or context-adaptive arithmetic coding (CABAC), and outputsyntax elements required for image reconstruction and quantized valuesof transform coefficients for residual. More specifically, the CABACentropy decoding method may receive a bin corresponding to each syntaxelement in the bitstream, determine a context model by using a decodingtarget syntax element information, decoding information of a decodingtarget block or information of a symbol/bin decoded in a previous stage,and perform an arithmetic decoding on the bin by predicting aprobability of occurrence of a bin according to the determined contextmodel, and generate a symbol corresponding to the value of each syntaxelement. In this case, the CABAC entropy decoding method may update thecontext model by using the information of the decoded symbol/bin for acontext model of a next symbol/bin after determining the context model.The information related to the prediction among the information decodedby the entropy decoder 310 may be provided to the predictor (interpredictor 332 and intra predictor 331), and residual values on which theentropy decoding has been performed in the entropy decoder 310, that is,the quantized transform coefficients and related parameter information,may be input to the residual processor 320.

The residual processor 320 may derive a residual signal (residual block,residual samples, or residual sample array). Also, information onfiltering among the information decoded by the entropy decoder 310 maybe provided to the filter 350. Meanwhile, a receiving unit (not shown)for receiving a signal output from the encoding apparatus may be furtherconfigured as an internal/external element of the decoding apparatus300, or the receiving unit may be a component of the entropy decoder310. Meanwhile, the decoding apparatus according to the present documentmay be called a video/image/picture decoding apparatus, and the decodingapparatus may be divided into an information decoder(video/image/picture information decoder) and a sample decoder(video/image/picture sample decoder). The information decoder mayinclude the entropy decoder 310, and the sample decoder may include atleast one of the dequantizer 321, the inverse transformer 322, the adder340, the filter 350, the memory 360, an inter predictor 332, and anintra predictor 331.

The dequantizer 321 may dequantize the quantized transform coefficientsto output the transform coefficients. The dequantizer 321 may rearrangethe quantized transform coefficients in a two-dimensional block form. Inthis case, the rearrangement may be performed based on a coefficientscan order performed by the encoding apparatus. The dequantizer 321 mayperform dequantization for the quantized transform coefficients using aquantization parameter (e.g., quantization step size information), andacquire the transform coefficients.

The inverse transformer 322 inversely transforms the transformcoefficients to acquire the residual signal (residual block, residualsample array).

In the present document, at least one of quantization/dequantizationand/or transform/inverse transform may be omitted. When thequantization/dequantization is omitted, the quantized transformcoefficient may be referred to as a transform coefficient. When thetransform/inverse transform is omitted, the transform coefficient may becalled a coefficient or a residual coefficient or may still be calledthe transform coefficient for uniformity of expression.

In the present document, the quantized transform coefficient and thetransform coefficient may be referred to as a transform coefficient anda scaled transform coefficient, respectively. In this case, the residualinformation may include information on transform coefficient(s), and theinformation on the transform coefficient(s) may be signaled throughresidual coding syntax. Transform coefficients may be derived based onthe residual information (or information on the transformcoefficient(s)), and scaled transform coefficients may be derivedthrough inverse transform (scaling) on the transform coefficients.Residual samples may be derived based on inverse transform (transform)of the scaled transform coefficients. This may be applied/expressed inother parts of the present document as well.

The predictor 330 may perform the prediction of the current block, andgenerate a predicted block including the prediction samples of thecurrent block. The predictor may determine whether the intra predictionis applied or the inter prediction is applied to the current block basedon the information on prediction output from the entropy decoder 310,and determine a specific intra/inter prediction mode.

The predictor 330 may generate a prediction signal based on variousprediction methods to be described later. For example, the predictor mayapply intra prediction or inter prediction for prediction of one block,and may simultaneously apply intra prediction and inter prediction. Thismay be called combined inter and intra prediction (CIIP). In addition,the predictor may be based on an intra block copy (IBC) prediction modeor based on a palette mode for prediction of a block. The IBC predictionmode or the palette mode may be used for image/video coding of contentsuch as games, for example, screen content coding (SCC). IBC maybasically perform prediction within the current picture, but may beperformed similarly to inter prediction in that a reference block isderived within the current picture. That is, IBC may use at least one ofthe inter prediction techniques described in the present document. Thepalette mode may be considered as an example of intra coding or intraprediction. When the palette mode is applied, information on the palettetable and the palette index may be included in the video/imageinformation and signaled.

The intra predictor 331 may predict the current block by referring tothe samples in the current picture. The referred samples may be locatedin the neighborhood of the current block, or may be located apart fromthe current block according to the prediction mode. In intra prediction,prediction modes may include a plurality of non-directional modes and aplurality of directional modes. The intra predictor 331 may determinethe prediction mode to be applied to the current block by using theprediction mode applied to the neighboring block.

The inter predictor 332 may derive a predicted block for the currentblock based on a reference block (reference sample array) specified by amotion vector on a reference picture. In this case, in order to reducethe amount of motion information being transmitted in the interprediction mode, motion information may be predicted in the unit ofblocks, subblocks, or samples based on correlation of motion informationbetween the neighboring block and the current block. The motioninformation may include a motion vector and a reference picture index.The motion information may further include information on interprediction direction (L0 prediction, L1 prediction, Bi prediction, andthe like). In case of inter prediction, the neighboring block mayinclude a spatial neighboring block existing in the current picture anda temporal neighboring block existing in the reference picture. Forexample, the inter predictor 332 may construct a motion informationcandidate list based on neighboring blocks, and derive a motion vectorof the current block and/or a reference picture index based on thereceived candidate selection information. Inter prediction may beperformed based on various prediction modes, and the information on theprediction may include information indicating a mode of inter predictionfor the current block.

The adder 340 may generate a reconstructed signal (reconstructedpicture, reconstructed block, or reconstructed sample array) by addingthe obtained residual signal to the prediction signal (predicted blockor predicted sample array) output from the predictor (including interpredictor 332 and/or intra predictor 331). If there is no residual forthe processing target block, such as a case that a skip mode is applied,the predicted block may be used as the reconstructed block.

The adder 340 may be called a reconstructor or a reconstructed blockgenerator. The generated reconstructed signal may be used for the intraprediction of a next block to be processed in the current picture, andas described later, may also be output through filtering or may also beused for the inter prediction of a next picture.

Meanwhile, a luma mapping with chroma scaling (LMCS) may also be appliedin the picture decoding process.

The filter 350 may improve subjective/objective image quality byapplying filtering to the reconstructed signal. For example, the filter350 may generate a modified reconstructed picture by applying variousfiltering methods to the reconstructed picture, and store the modifiedreconstructed picture in the memory 360, specifically, in a DPB of thememory 360. The various filtering methods may include, for example,deblocking filtering, a sample adaptive offset, an adaptive loop filter,a bilateral filter, and the like.

The (modified) reconstructed picture stored in the DPB of the memory 360may be used as a reference picture in the inter predictor 332. Thememory 360 may store the motion information of the block from which themotion information in the current picture is derived (or decoded) and/orthe motion information of the blocks in the picture having already beenreconstructed. The stored motion information may be transferred to theinter predictor 332 so as to be utilized as the motion information ofthe spatial neighboring block or the motion information of the temporalneighboring block. The memory 360 may store reconstructed samples ofreconstructed blocks in the current picture, and transfer thereconstructed samples to the intra predictor 331.

In the present document, the embodiments described in the filter 260,the inter predictor 221, and the intra predictor 222 of the encodingapparatus 200 may be applied equally or to correspond to the filter 350,the inter predictor 332, and the intra predictor 331.

Meanwhile, the video/image coding method according to the presentdocument may be performed based on the following partitioning structure.Specifically, above described procedures of prediction, residualprocessing ((inverse) transform and (de)quantization), syntax elementcoding, and filtering may be performed based on CTU and CU (and/or TUand PU) derived based on the partitioning structure. A blockpartitioning procedure may be performed by the image partitioner 210 ofthe above-described encoding apparatus, and partitioning-relatedinformation may be (encoding) processed by the entropy encoder 240, andmay be transferred to the decoding apparatus in the form of a bitstream.The entropy decoder 310 of the decoding apparatus may derive the blockpartitioning structure of the current picture based on thepartitioning-related information obtained from the bitstream, and basedon this, may perform a series of procedures (e.g., prediction, residualprocessing, block/picture reconstruction, in-loop filtering, and thelike) for image decoding. The CU size and the TU size may be equal toeach other, or a plurality of TUs may be present within a CU region.Meanwhile, the CU size may generally represent a luma component (sample)coding block (CB) size. The TU size may generally represent a lumacomponent (sample) transform block (TB) size. The chroma component(sample) CB or TB size may be derived based on the luma component(sample) CB or TB size in accordance with a component ratio according toa color format (chroma format, e.g., 4:4:4, 4:2:2, 4:2:0 and the like)of a picture/image. The TU size may be derived based on maxTbSize. Forexample, if the CU size is larger than the maxTbSize, a plurality of TUs(TBs) of the maxTbSize may be derived from the CU, and thetransform/inverse transform may be performed in the unit of TU (TB).Further, for example, in case that intra prediction is applied, theintra prediction mode/type may be derived in the unit of CU (or CB), andneighboring reference sample derivation and prediction sample generationprocedures may be performed in the unit of TU (or TB). In this case, oneor a plurality of TUs (or TBs) may be present in one CU (or CB) region,and in this case, the plurality of TUs (or TBs) may share the same intraprediction mode/type.

Further, in the video/image coding according to the present document, animage processing unit may have a hierarchical structure. One picture maybe partitioned into one or more tiles, bricks, slices, and/or tilegroups. One slice may include one or more bricks. On brick may includeone or more CTU rows within a tile. The slice may include an integernumber of bricks of a picture. One tile group may include one or moretiles. One tile may include one or more CTUs. The CTU may be partitionedinto one or more CUs. A tile represents a rectangular region of CTUswithin a particular tile column and a particular tile row in a picture.A tile group may include an integer number of tiles according to a tileraster scan in the picture. A slice header may carryinformation/parameters that can be applied to the corresponding slice(blocks in the slice). In case that the encoding/decoding apparatus hasa multi-core processor, encoding/decoding processes for the tiles,slices, bricks, and/or tile groups may be processed in parallel. In thepresent document, the slice or the tile group may be used exchangeably.That is, a tile group header may be called a slice header. Here, theslice may have one of slice types including intra (I) slice, predictive(P) slice, and bi-predictive (B) slice. In predicting blocks in I slice,inter prediction may not be used, and only intra prediction may be used.Of course, even in this case, signaling may be performed by coding theoriginal sample value without prediction. With respect to blocks in Pslice, intra prediction or inter prediction may be used, and in case ofusing the inter prediction, only uni-prediction can be used. Meanwhile,with respect to blocks in B slice, the intra prediction or interprediction may be used, and in case of using the inter prediction, up tobi-prediction can be maximally used.

The encoding apparatus may determine the tile/tile group, brick, slice,and maximum and minimum coding unit sizes in consideration of the codingefficiency or parallel processing, or according to the characteristics(e.g., resolution) of a video image, and information for them orinformation capable of inducing them may be included in the bitstream.

The decoding apparatus may obtain information representing the tile/tilegroup, brick, and slice of the current picture, and whether the CTU inthe tile has been partitioned into a plurality of coding units. Bymaking such information be obtained (transmitted) only under a specificcondition, the efficiency can be enhanced.

As described above, one picture may include a plurality of slices, andone slice may include a slice header and slice data. In this case, onepicture header may be further added for the plurality of slices (set ofslice headers and slice data) in the one picture. The picture header(picture header syntax) may include information/parameters commonlyapplicable to the picture. The slice header (slice header syntax) mayinclude information/parameters commonly applicable to the slice. Anadaptation parameter set (APS) or a picture parameter set (PPS) mayinclude information/parameters commonly applicable to one or morepictures. A sequence parameter set (SPS) may includeinformation/parameters commonly applicable to one or more sequences. Avideo parameter set (VPS) may include information/parameters commonlyapplicable to multiple layers. A decoding parameter set (DPS) mayinclude information/parameters commonly applicable to a video ingeneral. The DPS may include information/parameters related toconcatenation of coded video sequences (CVSs).

In the present document, a high-level syntax may include at least one ofan APS syntax, a PPS syntax, a SPS syntax, a VPS syntax, a DPS syntax, apicture header syntax, and a slice header syntax.

In addition, for example, information on partition and configuration ofthe tile/tile group/brick/slice may be configured in the encodingapparatus based on the high-level syntax and may be transmitted to thedecoding apparatus in the form of a bitstream.

FIG. 4 exemplarily shows a hierarchical structure for a codedimage/video.

Referring to FIG. 4 , the coded image/video is divided into VCL (videocoding layer) Zthat deals with an image/video decoding process anditself, a subsystem that transmits and stores the coded information, anda network abstraction layer (NAL) that exists between the VCL andsubsystems and is responsible for network adaptation functions.

The VCL may generate VCL data including compressed image data (slicedata), or generate parameter sets including a picture parameter set(Picture Parameter Set: PPS), a sequence parameter set (SequenceParameter Set: SPS), a video parameter set (Video Parameter Set: VPS)etc. or a supplemental enhancement information (SEI) messageadditionally necessary for the decoding process of an image.

In the NAL, a NAL unit may be generated by adding header information(NAL unit header) to a raw byte sequence payload (RBSP) generated in theVCL. In this case, the RBSP refers to slice data, parameter sets, SEImessages, etc. generated in the VCL. The NAL unit header may include NALunit type information specified according to RBSP data included in thecorresponding NAL unit.

As shown in the figure, the NAL unit may be divided into a VCL NAL unitand a Non-VCL NAL unit according to the RBSP generated in the VCL. TheVCL NAL unit may mean a NAL unit including information (sliced data)about an image, and the Non-VCL NAL unit may mean a NAL unit containinginformation (parameter set or SEI message) necessary for decoding animage.

The above-described VCL NAL unit and Non-VCL NAL unit may be transmittedthrough a network by attaching header information according to a datastandard of the subsystem. For example, the NAL unit may be transformedinto a data form of a predetermined standard such as H.266/VVC fileformat, Real-time Transport Protocol (RTP), Transport Stream (TS), etc.and transmitted through various networks.

As described above, in the NAL unit, the NAL unit type may be specifiedaccording to the RBSP data structure included in the corresponding NALunit, and information on this NAL unit type may be stored and signaledin the NAL unit header.

For example, the NAL unit may be roughly classified into the VCL NALunit type and the Non-VCL NAL unit type depending on whether the NALunit includes information about the image (slice data). The VCL NAL unittype may be classified according to property and a type of a pictureincluded in the VCL NAL unit, and the Non-VCL NAL unit type may beclassified according to the type of a parameter set.

The following is an example of the NAL unit type specified according tothe type of parameter set included in the Non-VCL NAL unit type.

-   -   APS (Adaptation Parameter Set) NAL unit: Type for NAL unit        including APS    -   DPS (Decoding Parameter Set) NAL unit: Type for NAL unit        including DPS    -   VPS (Video Parameter Set) NAL unit: Type for NAL unit including        VPS    -   SPS (Sequence Parameter Set) NAL unit: Type for NAL unit        including SPS    -   PPS (Picture Parameter Set) NAL unit: Type for NAL unit        including PPS    -   PH (Picture header) NAL unit: Type for NAL unit including PH

The above-described NAL unit types have syntax information for the NALunit type, and the syntax information may be stored and signaled in theNAL unit header. For example, the syntax information may benal_unit_type, and NAL unit types may be specified by a nal_unit_typevalue.

Meanwhile, as described above, one picture may include a plurality ofslices, and one slice may include a slice header and slice data. In thiscase, one picture header may be further added to a plurality of slices(a slice header and a slice data set) in one picture. The picture header(picture header syntax) may include information/parameters commonlyapplicable to the picture. The slice header (slice header syntax) mayinclude information/parameters commonly applicable to the slice. The APS(APS syntax) or PPS (PPS syntax) may include information/parameterscommonly applicable to one or more slices or pictures. The SPS (SPSsyntax) may include information/parameters commonly applicable to one ormore sequences. The VPS (VPS syntax) may include information/parameterscommonly applicable to multiple layers. The DPS (DPS syntax) may includeinformation/parameters commonly applicable to the entire video. The DPSmay include information/parameters related to concatenation of a codedvideo sequence (CVS).

In this document, high level syntax (HLS) may include at least one ofthe APS syntax, PPS syntax, SPS syntax, VPS syntax, DPS syntax, pictureheader syntax, and slice header syntax.

In addition, for example, the information on the partition andconfiguration of the tile/tile group/brick/slice may be configured in anencoding terminal based on the high-level syntax and may be transmittedto the decoding apparatus in the form of the bitstream.

In this document, the image/video encoded in the encoding apparatus andsignaled to the decoding apparatus in the form of the bitstream mayinclude not only intra-picture partitioning-related information,intra/inter prediction information, residual information, and in-loopfiltering information but also the information included in the sliceheader, the information included in the picture header, the informationincluded in the APS, the information included in the PPS, theinformation included in the SPS, the information included in the VPS,and/or the information included in the DPS. Further, the image/videoinformation may further include the information of the NAL unit header.

A video/image encoding procedure based on inter prediction mayschematically include, for example, the following.

FIG. 5 illustrates an example of an inter prediction-based video/imageencoding method, and FIG. 6 schematically illustrates an inter predictorin an encoding apparatus.

Referring to FIG. 5 and FIG. 6 , the encoding apparatus performs interprediction on a current block (S500). The encoding apparatus may derivean inter prediction mode and motion information on the current block,and may generate prediction samples for the current block. Here,procedures for determining the inter prediction mode, deriving themotion information, and generating the prediction samples may beperformed simultaneously, or one procedure may be performed beforeanother procedure. For example, the inter predictor 221 of the encodingapparatus may include a prediction mode determinator 221_1, a motioninformation deriver 221_2, and a prediction sample deriver 221_3,wherein the prediction mode determinator 221_1 may determine theprediction mode for the current block, the motion information deriver221_2 may derive the motion information on the current block, and theprediction sample deriver 221_3 may derive the prediction samples forthe current block. For example, the inter predictor of the encodingapparatus may search for a block similar to the current block within apredetermined area (search area) of reference pictures through motionestimation, and may derive a reference block having a difference fromthe current block that is a minimum or a predetermined reference levelor less. The inter predictor may derive a reference picture indexindicating a reference picture in which the reference block is locatedbased on the reference block, and may derive a motion vector based on apositional difference between the reference block and the current block.The encoding apparatus may determine a mode to be applied to the currentblock among various prediction modes. The encoding apparatus may comparerate-distortion (RD) costs of the various prediction modes and maydetermine an optimal prediction mode for the current block.

For example, when a skip mode or a merge mode is applied to the currentblock, the encoding apparatus may construct a merge candidate list, andmay derive a reference block having a difference from the current blockthat is the minimum or the predetermined reference level or less amongreference blocks indicated by merge candidates included in the mergecandidate list. In this case, a merge candidate associated with thederived reference block may be selected, and merge index informationindicating the selected merge candidate may be generated and signaled tothe decoding apparatus. The motion information on the current block maybe derived using motion information on the selected merge candidate.

In another example, when an (A)MVP mode is applied to the current block,the encoding apparatus may construct an (A)MVP candidate list, and mayuse a motion vector of a motion vector predictor (mvp) candidateselected from among mvp candidates included in the (A)MVP candidate listas an mvp of the current block. In this case, for example, a motionvector indicating a reference block derived by the motion estimation maybe used as a motion vector of the current block, and an mvp candidatehaving a motion vector having the smallest difference from the motionvector of the current block among the mvp candidates may be the selectedmvp candidate. A motion vector difference (MVD), which is a differenceobtained by subtracting the mvp from the motion vector of the currentblock, may be derived. In this case, information on the MVD may besignaled to the decoding device. When the (A)MVP mode is applied, thevalue of the reference picture index may be configured as referencepicture index information and may be separately signaled to the decodingapparatus.

The encoding apparatus may derive residual samples based on theprediction samples (S510). The encoding apparatus may derive theresidual samples by comparing original samples of the current block withthe prediction samples.

The encoding apparatus encodes image information including predictioninformation and residual information (S520). The encoding apparatus mayoutput the encoded image information in the form of a bitstream. Theprediction information is information related to the predictionprocedure, and may include prediction mode information (e.g., a skipflag, a merge flag, or a mode index) and information on motioninformation. The information on the motion information may includecandidate selection information (e.g., a merge index, an mvp flag, or anmvp index) that is information for deriving a motion vector. Inaddition, the information on the motion information may include theinformation on the MVD and/or reference picture index information.Further, the information on the motion information may includeinformation indicating whether L0 prediction, L1 prediction, orbi-prediction is applied. The residual information is information on theresidual samples. The residual information may include information onquantized transform coefficients for the residual samples.

The output bitstream may be stored in a (digital) storage medium and betransmitted to the decoding apparatus, or may be transmitted to thedecoding apparatus through a network.

As described above, the encoding apparatus may generate a reconstructedpicture (including reconstructed samples and reconstructed blocks) basedon the reference samples and the residual samples, which is for theencoding apparatus to derive the same prediction result as that derivedby the decoding apparatus and for increasing coding efficiency.Accordingly, the encoding apparatus may store the reconstructed picture(or reconstructed samples and reconstructed block) in the memory and mayuse the same as a reference picture for inter prediction. As describedabove, an in-loop filtering procedure may be further applied to thereconstructed picture.

A video/image decoding procedure based on inter prediction mayschematically include, for example, the following.

FIG. 7 illustrates an example of an inter prediction-based video/imagedecoding method, and FIG. 8 schematically illustrates an inter predictorin a decoding apparatus.

The decoding apparatus may perform an operation corresponding to theforegoing operation performed by the encoding apparatus. The decodingapparatus may predict the current block based on the received predictioninformation and may derive prediction samples.

Specifically, referring to FIG. 7 and FIG. 8 , the decoding apparatusmay determine a prediction mode for the current block based on theprediction information received from a bitstream (S700). The decodingapparatus may determine which inter prediction mode is applied to thecurrent block based on prediction mode information in the predictioninformation.

For example, whether the merge mode is applied to the current block orwhether the (A)MVP mode is determined may be determined based on themerge flag. Alternatively, one of various inter prediction modecandidates may be selected based on the merge index. The interprediction mode candidates may include various inter prediction modes,such as the skip mode, the merge mode, and/or the (A)MVP mode.

The decoding apparatus derives motion information on the current blockbased on the determined inter prediction mode (S710). For example, whenthe skip mode or the merge mode is applied to the current block, thedecoding apparatus may construct a merge candidate list to be describedlater and may select one merge candidate from among merge candidatesincluded in the merge candidate list. The selection may be performedbased on the foregoing selection information (merge index). The motioninformation on the current block may be derived using motion informationon the selected merge candidate. The motion information on the selectedmerge candidate may be used as the motion information on the currentblock.

In another example, when the (A)MVP mode is applied to the currentblock, the decoding apparatus may construct an (A)MVP candidate list,and may use a motion vector of a motion vector predictor (mvp) candidateselected from among mvp candidates included in the (A)MVP candidate listas an mvp of the current block. The selection may be performed based onthe foregoing selection information (mvp flag or mvp index). In thiscase, the decoding apparatus may derive an MVD of the current blockbased on the information on the MVD, and may derive a motion vector ofthe current block based on the mvp of the current block and the MVD.Further, the decoding apparatus may derive a reference picture index ofthe current block based on the reference picture index information. Apicture indicated by the reference picture index in a reference picturelist for the current block may be derived as a reference picturereferenced for inter prediction of the current block.

The motion information on the current block may be derived withoutconstructing a candidate list, in which case construction of a candidatelist described above may be omitted.

The decoding apparatus may generate prediction samples for the currentblock based on the motion information on the current block (S720). Inthis case, the reference picture may be derived based on the referencepicture index of the current block, and the prediction samples for thecurrent block may be derived using samples of a reference blockindicated by the motion vector of the current block in the referencepicture. In this case, as described later, a prediction sample filteringprocedure for all or some of the prediction samples for the currentblock may be further performed depending on the case.

For example, the inter predictor 332 of the decoding apparatus mayinclude a prediction mode determinator 332_1, a motion informationderiver 332_2, and a prediction sample deriver 332_3, wherein theprediction mode determinator 332_1 may determine the prediction mode forthe current block based on the received prediction mode information, themotion information deriver 332_2 may derive the motion information(motion vector and/or reference picture index) on the current blockbased on the received information on the motion information, and theprediction sample deriver 332_3 may derive the prediction samples forthe current block.

The decoding apparatus generates residual samples for the current blockbased on the received residual information (S730). The decodingapparatus may generate reconstructed samples for the current block basedon the prediction samples and the residual samples, and may generate areconstructed picture based reconstructed samples (S740). Subsequently,as described above, an in-loop filtering procedure may be furtherapplied to the reconstructed picture.

A predicted block for a current block may be derived based on motioninformation derived according to a prediction mode of the current block.The predicted block may include prediction samples (prediction samplearray) for the current block. When a motion vector of the current blockindicates a fractional sample unit, an interpolation procedure may beperformed, through which the prediction samples for the current blockmay be derived based on reference samples in a fractional sample unit ina reference picture. When affine inter prediction is applied to thecurrent block, the prediction samples may be generated based on a motionvector (MV) in a sample/subblock unit. When bi-prediction is applied,prediction samples derived through the weighted sum or weighted averageof prediction samples derived based on L0 prediction (i.e., predictionusing a reference picture in reference picture list L0 and MVL0) andprediction samples derived based on L1 prediction (i.e., predictionusing a reference picture in reference picture list L1 and MVL1)(according to phase) may be used as the prediction samples for thecurrent block. A case where bi-prediction is applied and the referencepicture used for L0 prediction and the reference picture used for L1prediction are located in different temporal directions with respect tothe current picture (i.e., corresponding to bi-prediction andbidirectional prediction) may be referred to as true bi-prediction.

As described above, reconstructed samples and reconstructed pictures maybe generated based on the derived prediction samples, after which anin-loop filtering procedure may be performed.

In inter prediction, weighted sample prediction may be used. Weightedsample prediction may be referred to as weighted prediction. Weightedprediction may be applied when the slice type of a current slice inwhich a current block (e.g., CU) is located is a P slice or a B slice.That is, weighted prediction may be used not only when bi-prediction isapplied but also when uni-prediction is applied. For example, asdescribed below, weighted prediction may be determined based onweightedPredFlag, and the value of weightedPredFlag may be determinedbased on signaled pps_weighted_pred_flag (in a case of a P slice) orpps_weighted_bipred_flag (in a case of a B slice). For example, whenslice_type is P, weightedPredFlag may be set to pps_weighted_pred_flag.Otherwise (when slice_type is B), weightedPredFlag may be set topps_weighted_bipred_flag.

Prediction samples as output of weighted prediction or the values of theprediction samples may be referred to as pbSamples.

Weighted prediction procedures may be largely divided into a defaultweighted (sample) prediction procedure and an explicit weighted (sample)prediction procedure. A weighted (sample) prediction procedure may referto only the explicit weighted (sample) prediction procedure. Forexample, when the value of weightedPredFlag is 0, the values ofprediction samples (pbSamples) may be derived based on the defaultweighted (sample) prediction procedure. When the value ofweightedPredFlag is 1, the values of prediction samples (pbSamples) maybe derived based on the explicit weighted (sample) prediction procedure.

When bi-prediction is applied to a current block, prediction samples maybe derived based on a weighted average. Conventionally, a bi-predictionsignal (i.e., bi-prediction samples) may be derived through simpleaveraging of an L0 prediction signal (L0 prediction samples) and an L1prediction signal (L1 prediction samples). That is, the bi-predictionsamples are derived as the average of the L0 prediction samples based onan L0 reference picture and MVL0 and the L1 prediction samples based onan L1 reference picture and MVL1. However, according to the presentdocument, when bi-prediction is applied, a bi-prediction signal(bi-prediction samples) may be derived through weighted averaging of theL0 prediction signal and the L1 prediction signal.

Bi-directional optical flow (BDOF) may be used to refine a bi-predictionsignal. BDOF is for generating prediction samples by calculatingimproved motion information when bi-prediction is applied to a currentblock (e.g., a CU), and the process of calculating the improved motioninformation may be included in the motion information derivationoperation.

For example, BDOF may be applied in a 4×4 subblock level. That is, BDOFmay be performed in units of 4×4 subblocks in the current block. BDOFmay be applied only to a luma component. Alternatively, BDOF may beapplied only to a chroma component, or may be applied to a lumacomponent and a chroma component.

As described above, a high-level syntax (HLS) may be coded/signaled forvideo/image coding. Video/image information may be included in the HLS.

A coded picture may include one or more slices. A parameter describingthe coded picture is signaled in a picture header, and a parameterdescribing a slice is signaled in a slice header. The picture header iscarried in the form of an independent NAL unit. The slice header existsat the beginning of a NAL unit including a payload of the slice (i.e.,slice data).

Each picture is associated with a picture header. A picture may includedifferent types of slices (intra-coded slices (i.e., I slices) andinter-coded slices (i.e., P slices and B slices)). Accordingly, apicture header may include syntax elements necessary for an intra sliceof a picture and an inter slice of the picture.

A picture may be partitioned into subpictures, tiles, and/or slices.Subpicture signaling may exist in a sequence parameter set (SPS), andtile and square slice signaling may exist in a picture parameter set(PPS). Raster scan slice signaling may exist in a slice header.

When weighted prediction is applied for inter prediction of a currentblock, the weighted prediction may be performed based on information onthe weighted prediction.

A weighted prediction procedure may start based on two flags in an SPS.

For example, syntax elements shown below in Table 1 may be included inan SPS syntax with respect to the weighted prediction.

TABLE 1 Descriptor seq_parameter_set_rbsp( ) { sps_decoding_parameter_set_id u(4) ...  sps_weighted_pred_flag u(1) sps_weighted_bipred_flag u(1) ... }

In Table 1, the value of sps_weighted_pred_flag equal to 1 may indicatethat weighted prediction is applied to P slices referring to the SPS.

The value of sps_weighted_bipred_flag equal to 1 may indicate thatweighted prediction is applied to B slices referring to the SPS. Thevalue of sps_weighted_bipred_flag equal to 0 may indicate that weightedprediction is not applied to B slices referring to the SPS.

The two flags signaled in the SPS indicate whether weighted predictionis applied to P and B slices in a coded video sequence (CVS).

Syntax elements shown below in Table 2 may be included in a PPS syntaxwith respect to the weighted prediction.

TABLE 2 Descriptor pic_parameter_set_rbsp( ) {  pps_pic_parameter_set_idue(v) ...  pps_weighted_pred_flag u(1)  pps_weighted_bipred_flag u(1)...

In Table 2, the value of pps_weighted_pred_flag equal to 0 may indicatethat weighted prediction is not applied to P slices referring to thePPS. The value of pps_weighted_pred_flag equal to 1 may indicate thatweighted prediction is applied to the P slices referring to the PPS.When the value of sps_weighted_pred_flag is 0, the value ofpps_weighted_pred_flag is 0.

The value of pps_weighted_bipred_flag equal to 0 may indicate thatweighted prediction is not applied to B slices referring to the PPS. Thevalue of pps_weighted_bipred_flag equal to 1 may indicate that explicitweighted prediction is applied to the B slices referring to the PPS.When the value of sps_weighted_bipred_flag is 0, the value ofpps_weighted_bipred_flag is 0.

Additionally, syntax elements shown below in Table 3 may be included ina slice header syntax.

TABLE 3 Descriptor slice_header( ) {  slice_pic_parameter_set_id ue(v)...  if( ( nal_unit_type != IDR_W_RADL && nal_unit_type != IDR_N_LP ) ||   sps_idr_rpl_present_flag ) {   for( i = 0; i < 2; i++ ) {    if(num_ref_pic_lists_in_sps[ i ] > 0 && !pps_ref_pic_list_sps_idc[ i ] &&        ( i = = 0 || ( i = = 1 && rpl1_idx_present_flag ) ) )    ref_pic_list_sps_flag[ i ]    if( ref_pic_list_sps_flag[ i ] ) {    if( num_ref_pic_lists_in_sps[ i ] > 1 &&        ( i = = 0 || ( i = =1 && rpl1_idx_present_flag ) ) )       ref_pic_list_idx[ i ]    } else    ref_pic_list_struct( i, num_ref_pic_lists_in_sps[ i ] )    for( j =0; j < NumLtrpEntries[ i ][ RplsIdx[ i ] ]; j++ ) {     if(ltrp_in_slice_header_flag[ i ][ RplsIdx[ i ] ] )      slice_poc_lsb_lt[i ][ j ]     delta_poc_msb_present_flag[ i ][ j ]     if(delta_poc_msb_present_flag[ i ][ j ] )      delta_poc_msb_cycle_lt[ i ][j ]    }   }   if( ( slice_type != I && num_ref_entries[ 0 ][ RplsIdx[ 0] ] > 1 ) | |    ( slice_type = = B && num_ref_entries[ 1 ][ RplsIdx[ 1] ] > 1 ) ) {    num_ref_idx_active_override_flag    if(num_ref_idx_active_override_flag )     for( i = 0; i < ( slice_type = =B ? 2: 1 ); i++ )      if( num_ref_entries[ i ][ RplsIdx[ i ] ] > 1 )      num_ref_idx_active_minus1[ i ]   }  } ...   if( (pps_weighted_pred_flag && slice_type = = P ) ||    (pps_weighted_bipred_flag && slice_type = = B ) )    pred_weight_tablet() ... }

In Table 3, slice_pic_parameter_set_id indicates the value ofpps_pic_parameter_set_id for a PPS being used. The value ofslice_pic_parameter_set_id is included in a range from 0 to 63.

The value of a temporary ID (TempralID) of the current picture needs tobe greater than or equal to the value of TempralID of the PPS havingpps_pic_parameter_set_id that is the same as slice_pic_parameter_set_id.

A prediction weighted table syntax may include information on weightedprediction shown below in Table 4.

TABLE 4 Descriptor pred_weight_table( ) {  luma_log2_weight_denom ue(v) if( ChromaArrayType != 0 )   delta_chroma_log2_weight_denom se(v)  for(i = 0; i < NumRefIdxActive[ 0 ]; i++ )   luma_weight_l0_flag[ i ] u(1) if( ChromaArrayType != 0 )   for( i = 0; i < NumRefIdxActive[ 0 ]; i++)    chroma_weight_l0_flag[ i ] u(1)  for( i = 0; i < NumRefIdxActive[ 0]; i++ ) {   if( luma_weight_l0_flag [ i ] ) {    delta_luma_weight_l0[i ] se(v)    luma_offset_l0[ i ] se(v)   }   if( chroma_weight_l0_flag[i ] )    for( j = 0; j < 2; j++ ) {     delta_chroma_weight_l0[ i ][ j ]se(v)     delta_chroma_offset_l0[ i ][ j ] se(v)    }  }  if( slice_type= = B ) {   for( i = 0; i < NumRefIdxActive[ 1 ]; i++ )   luma_weight_l1_flag[ i ] u(1)   if( ChromaArrayType != 0 )    for( i= 0; i < NumRefIdxActive[ 1 ]; i++ )     chroma_weight_l1_flag[ i ] u(1)  for( i = 0; i < NumRefIdxActive[ 1 ]; i++ ) {    if(luma_weight_l1_flag[ i ] ) {     delta_luma_weight_l1[ i ] se(v)    luma_offset_l1[ i ] se(v)    }    if( chroma_weight_l1_flag[ i ] )    for( j = 0; j < 2; j++ ) {      delta_chroma_weight_l1[ i ][ j ]se(v)      delta_chroma_offset_l1[ i ][ j ] se(v)     }   }  } }

In Table 4, luma_log 2_weight_denom is the base-2 logarithm of adenominator for all luma weighting factors. The value of luma_log2_weight_denom is included in a range from 0 to 7.

delta_chroma_log 2_weight_denom is the difference in the base-2logarithm of a denominator for all chroma weighting factors. Whendelta_chroma_log 2_weight_denom does not exist, delta_chroma_log2_weight_denom is inferred as 0.

ChromaLog2WeightDenom is derived as luma_log2_weight_denom+delta_chroma_log 2_weight_denom, and the value thereof isincluded in a range from 0 to 7.

The value of luma_weight_10_flag[i] equal to 1 indicates that there areweighting factors for a luma component of (reference picture) list 0(L0) prediction using RefPicList[0][i]. The value ofluma_weight_10_flag[i] equal to 0 indicates that these weighting factorsdo not exist.

The value of chroma_weight_10_flag[i] equal to 1 indicates that thereare weighting factors for chroma prediction values of L0 predictionusing RefPicList[0][i]. The value of chroma_weight_10_flag[i] equal to 0indicates that these weighting factors do not exist. Whenchroma_weight_10_flag[i] does not exist, chroma_weight_10_flag[i] isinferred as 0.

delta_luma_weight_10[i] is the difference in weighting factor applied toa luma prediction value for L0 prediction using RefPicList[0][i].

LumaWeightL0[i] is derived as (1<<luma_log2_weight_denom)+delta_luma_weight_10[i]. When luma_weight_10_flag[i] is1, the value of delta_luma_weight_10[i] is included in a range from −128to 127. When luma_weight_10_flag[i] is 0, LumaWeightL0[i] is inferred as2^(huma_log2_weight_denom).

luma_offset_10[i] is an additive offset applied to a luma predictionvalue for L0 prediction using RefPicList[0] [i]. The value ofluma_offset_10[i] is included in a range from −128 to 127. When thevalue of luma_weight_10_flag[i] is 0, the value of luma_offset_10[i] isinferred as 0.

delta_chroma_weight_10[i][j] is the difference in weighting factorapplied to a chroma prediction values for L0 prediction usingRefPicList[0] [i] where j is 0 for Cb and j is 1 for Cr.

ChromaWeightL0[i][j] is derived as(1<<ChromaLog2WeightDenom)+delta_chroma_weight_10[i][j]. Whenchroma_weight_10_flag[i] is 1, the value of delta_chroma_weight_10[i][j]is included in a range from −128 to 127. When chroma_weight_10_flag[i]is 0, ChromaWeightL0[i][j] is inferred as 2^(ChromaLog2WeightDenom).

delta_chroma_offset_10[i][j] is the difference in additive offsetapplied to the chroma prediction value for L0 prediction usingRefPicList[0] [i] where j is 0 for Cb and j is 1 for Cr.

The value of delta_chroma_offset_10[i][j] is included in a range from−4×128 to 4×127. When the value of chroma_weight_10_flag[i] is 0, thevalue of ChromaOffsetL0[i][j] is inferred as 0.

The prediction weighted table syntax is frequently used to modify asequence when there is a scene change. An existing prediction weightedtable syntax is signaled in a slice header when a PPS flag for weightedprediction is enabled and a slice type is P, or when a PPS flag forweighted bi-prediction is enabled and a slice type is B. However, theremay be often cases where a prediction weighted table needs to beadjusted for one or a plurality of frames when there is a scene change.In general, when a PPS is shared for a plurality of frames, signalinginformation on weighted prediction for all frames referring to the PPSmay be unnecessary.

The following drawings are provided to describe specific examples of thepresent document. Since specific terms for devices or specific terms forsignals/messages illustrated in the drawings are provided forillustration, technical features of the present disclosure are notlimited to the specific terms used in the following drawings.

The present document provides the following methods to solve theforegoing problems. The methods may be applied independently or may beapplied in combination with each other.

-   -   1. A tool for weighted prediction (information on weighted        prediction) may be applied in a picture level rather than in a        slice level. Weighting values are applied to a specific        reference picture of a picture, and are used for all slices of        the picture.    -   a. Alternatively, the tool for weighted prediction may be        applied in the picture level or the slice level, but may not be        applied in both levels for the same picture. That is, when        weighted prediction is applied in the picture level, additional        signaling for each slice of the picture is not needed for        weighted prediction.    -   b. Alternatively, the tool for weighted prediction may be        applied in the picture level and the slice level.    -   2. A prediction weighted table syntax may be signaled in a        picture level rather than in a slice level. To this end,        information on weighted prediction syntax may be signaled in a        picture header (PH) or a picture parameter set (PPS).    -   3. Alternatively, when a tool for weighted prediction is        applicable in a picture level or a slice level, the tool for        weighted prediction may be signaled in the picture level or the        slice level.    -   a. Picture-level signaling exists in a picture header.    -   b. Slice-level signaling exists in a slice header.    -   4. Alternatively, when a tool for weighted prediction is        applicable in a picture level or a slice level, the tool for        weighted prediction may be signaled in the picture level and may        then be overridden in the slice level.    -   a. Picture-level signaling exists in a picture header.    -   b. Slice-level signaling exists in a slice header.    -   5. When a prediction weighted table exists in a picture header,        the number of weighted reference pictures may be explicitly        signaled. One number for reference picture list 0 and one number        for reference picture list 1 may be signaled. When the        prediction weighted table exists in a slice header, the number        may be inferred from the numbers of active reference pictures        for reference picture list 0 and reference picture list 1.    -   6. When a tool for weighted prediction (e.g., a prediction        weighted table) is signaled in a picture header, reference        picture signaling for a picture (and slices of the picture) may        exist in the picture header.    -   7. When weighted prediction is applied in a picture level, if        the weighted prediction is applied to a picture, all slices of        the picture may have the same active reference pictures. This        includes the order of active reference pictures in a reference        picture list (i.e., L0 for P slices and L0 and L1 for B slices).    -   8. Alternatively, when the above does not apply, the following        may apply.    -   a. Signaling of weighted prediction is independent of signaling        of a reference picture list. That is, in signaling of a        prediction weighted table, there is no assumption about the        order of reference pictures in an RPL.    -   b. There is no signaling of weighted prediction values for        reference pictures in L0 and L1. Weighting values are directly        provided for the reference pictures.    -   c. Only one loop is used rather than two loops to signal        weighting values for a reference picture. In each loop, a        reference picture associated with a first signaled weighting        value is identified.    -   d. Reference picture identification is based on a picture order        count (POC) value.    -   e. For bit saving, a delta POC value between a reference picture        and a current picture may be signaled rather than signaling the        POC value of the reference picture.    -   9. In addition to item 4, to signal the delta POC value between        the reference picture and the current picture, the following may        be further specified so that an absolute delta POC value may be        signaled as follows.    -   a. A first signaled delta POC is the delta between the POC of        the reference picture and the POC of current picture.    -   b. The rest of signaled delta POCs (i.e., where i starts from 1)        is the delta between the POC of an ith reference picture and the        POC of an (i−1)th reference picture.    -   10. Two flags in a PPS may be unified into a single control flag        (e.g., pps_weighted_pred_flag). The flag may be used to indicate        that an additional flag exists in a picture header.    -   a. The flag in the PH may be conditioned on the PPS flag, and        when a NAL unit type is not instantaneous decoding refresh        (IDR), existence of pred_weighted_table( ) data (prediction        weighted table syntax)) may be further indicated.    -   11. Two flags (pps_weighted_pred_flag and        pps_weighted_bipred_flag) signaled in a PPS may be unified into        one flag. The one flag may use the existing name of        pps_weighted_pred_flag.    -   12. A flag may be signaled in a picture header to indicate        whether weighted prediction is applied to a picture associated        with the picture header. The flag may be referred to as        pic_weighted_pred_flag.    -   a. Existence of pic_weighted_pred_flag may be conditioned on the        value of pps_weighted_pred_flag. When the value of        pps_weighted_pred_flag is 0, pic_weighted_pred_flag does not        exist, and the value thereof may be inferred as 0.    -   b. When the value of pic_weighted_pred_flag is 1, signaling of        pred_weighted_table( ) may exist in the picture header.    -   13. Alternatively, when weighted prediction is enabled (i.e.,        the value of pps_weighted_pred_flag is 1 or the value of        pps_weighted_bipred_flag is 1), information on the weighted        prediction may still exist in a slice header, and the following        may apply.    -   a. A new flag may be signaled to indicate whether the        information on the weighted prediction exists in the slice        header. The flag may be referred to as        slice_weighted_pred_present_flag.    -   b. Existence of slice_weighted_pred_present_flag may be        determined according to a slice type and the values of        pps_weighted_pred_flag and pps_weighted_bipred_flag.

In the present document, information on weighted prediction may includeinformation/syntax elements related to the weighted prediction describedin Table 1 to Table 4. Video/image information may include variouspieces of information for inter prediction, such as information onweighted prediction, residual information, and inter prediction modeinformation. The inter prediction mode information may includeinformation/syntax elements, such as information indicating whether amerge mode or an MVP mode is applicable to a current block and selectioninformation for selecting one of motion candidates in a motion candidatelist. For example, when the merge mode is applied to the current block,a merge candidate list is constructed based on neighboring blocks of thecurrent block, and one candidate for deriving motion information on thecurrent block may be selected/used (based on a merge index) from themerge candidate list. In another example, when the MVP mode is appliedto the current block, an mvp candidate list may be constructed based onneighboring blocks of the current block, and one candidate for derivingmotion information on the current block may be selected/used (based onan mvp flag) from the mvp candidate list.

In an embodiment, for weighted prediction in inter prediction, a PPS mayinclude syntax elements shown below in Table 5, and the semantics of thesyntax elements may be as shown below in Table 6.

TABLE 5 Descriptor pic_parameter_set_rbsp( ) {  pps_pic_parameter_set_idue(v) ...  pps_weighted_pred_flag u(1) ... }

TABLE 6 pps_weighted_pred_flag equal to 0 specifies that weightedprediction is not applied to P or B slices referring to the PPS.pps_weighted_pred_flag equal to 1 specifies that weighted prediction isapplied to P or B slices referring to the PPS. Whensps_weighted_pred_flag is equal to 0, the value ofpps_weighted_pred_flag shall be equal to 0.

Referring to Table 5 and Table 6, the value of pps_weighted_pred_flagequal to 0 may indicate that weighted prediction is not applied to P orB slices referring to the PPS. The value of pps_weighted_pred_flag equalto 1 may indicate that weighted prediction is applied to P or B slicesreferring to the PPS.

In addition, a picture header may include syntax elements shown below inTable 7, and the semantics of the syntax elements may be as shown belowin Table 8.

TABLE 7 Descriptor picture_header_rbsp( ) {  non_reference_picture_flag...  pic_rpl_present_flag u(1)  if( pic_rpl_present_flag ) {   for( i =0; i < 2; i++ ) {    if( num_ref_pic_lists_in_sps[ i ] > 0 &&!pps_ref_pic_list_sps_idc[ i ] &&       ( i = = 0 || ( i = = 1 &&rpl1_idx_present_flag ) ) )     pic_rpl_sps_flag[ i ] u(1)    if(pic_rpl_sps_flag[ i ] ) {     if( num_ref_pic_lists_in_sps[ i ] > 1 &&       ( i = = 0 || ( i = = 1 && rpl1_idx_present_flag ) ) )     pic_rpl_idx[ i ] u(v)    } else     ref_pic_list_struct( i,num_ref_pic_lists_in_sps[ i ] )    for( j = 0; j < NumLtrpEntries[ i ][RplsIdx[ i ] ]; j++ ) {     if( ltrp_in_slice_header_flag[ i ][ RplsIdx[i ] ] )      pic_poc_lsb_lt[ i ][ j ] u(v)    pic_delta_poc_msb_present_flag[ i ][ j ] u(1)     if(pic_delta_poc_msb_present_flag[ i ][ j ] )     pic_delta_poc_msb_cycle_lt[ i ][ j ] ue(v)    }   }  } if(pps_weighted_pred_flag ) {  pic_weighted_pred_flag u(1)  if( (pic_weighted_pred_flag && ( nal_unit_type != IDR_W_RADL && nal_unit_type!= IDR_N_LP ) ) )   pred_weight_table( ) } ... }

TABLE 8 pic_weighted_pred_flag equal to 0 specifies that weightedprediction is not applied to P or B slices referring to the PH.pic_weighted_pred_flag equal to 1 specifies that weighted prediction isapplied to P or B slices referring to the PH. When not present, thevalue of pic_weighted_pred_flag shall be equal to 0.

Referring to Table 7 and Table 8, the value of pic_weighted_pred_flagequal to 0 may indicate that weighted prediction is not applied to P orB slices referring to the picture header. The value ofpic_weighted_pred_flag equal to 1 may indicate that weighted predictionis applied to P or B slices referring to the picture header.

When the value of pic_weighted_pred_flag is 1, all slices in the pictureassociated with the picture header may have the same reference picturelists. Otherwise, when the value of pic_weighted_pred_flag is 1, thevalue of pic_rpl_present_flag may be 1.

In the absence of the above condition, pic_weighted_pred_flag may besignaled as shown below in Table 9.

TABLE 9 Descriptor picture_header_rbsp( ) { ...  pic_rpl_present_flagu(1)  if( pic_rpl_present_flag ) {   ...  }  if( pps_weighted_pred_flag&& pic_rpl_present_flag ) {   pic_weighted_pred_flag u(1)   if( (pic_weighted_pred_flag && ( nal_unit_type != IDR_W_RADL &&    nal_unit_type != IDR_N_LP ) ) )    pred_weight_table( )  } ... }

A slice header may include syntax elements shown below in Table 10.

TABLE 10 Descriptor slice_header( ) {  slice_pic_parameter_set_id ue(v)...  if( ( nal_unit_type != IDR_W_RADL && nal_unit_type != IDR_N_LP ) ||   sps_idr_rpl_present_flag ) {   for( i = 0; i < 2; i++ ) {    if(num_ref_pic_lists_in_sps[ i ] > 0 && !pps_ref_pic_list_sps_idc[ i ] &&        ( i = = 0 || ( i = = 1 && rpl1_idx_present_flag ) ) )    ref_pic_list_sps_flag[ i ]    if( ref_pic_list_sps_flag[ i ] ) {    if( num_ref_pic_lists_in_sps[ i ] > 1 &&        ( i = = 0 || ( i = =1 && rpl1_idx_present_flag ) ) )       ref_pic_list_idx[ i ]    } else    ref_pic_list_struct( i, num_ref_pic_lists_in_sps[ i ] )    for( j =0; j < NumLtrpEntries[ i ][ RplsIdx[ i ] ]; j++ ) {     if(ltrp_in_slice_header_flag[ i ][ RplsIdx[ i ] ] )      slice_poc_lsb_lt[i ][ j ]     delta_poc_msb_present_flag[ i ][ j ]     if(delta_poc_msb_present_flag[ i ][ j ] )      delta_poc_msb_cycle_lt[ i ][j ]    }   }   if( ( slice_type != I && num_ref_entries[ 0 ][ RplsIdx[ 0] ] > 1 ) ||    ( slice_type = = B && num_ref_entries[ 1 ][ RplsIdx[ 1 ]] > 1 ) ) {    num_ref_idx_active_override_flag    if(num_ref_idx_active_override_flag )     for( i = 0; i < ( slice_type = =B ? 2: 1 ); i++ )      if( num_ref_entries[ i ][ RplsIdx[ i ] ] > 1 )      num_ref_idx_active_minus1[ i ]   }  } ... }

A prediction weighted table syntax may include syntax elements shownbelow in Table 11, and the semantics of the syntax elements may be asshown below in Table 12.

TABLE 11 Descriptor pred_weight_table( ) {  luma_log2_weight_denom ue(v) if( ChromaArrayType != 0 )   delta_chroma_log2_weight_denom se(v) num_l0_weighted_ref_pics ue(v)  for( i = 0; i <num_l0_weighted_ref_pics; i++ )   luma_weight_l0_flag[ i ]  if(ChromaArayType != 0 )   for( i = 0; i < NumRefIdxActive[ 0 ]; i++ )   chroma_weight_l0_flag[ i ] u(1)  for( i = 0; i < NumRefIdxActive[ 0]; i++ ) {   if( luma_weight_l0_flag[ i ] ) {    delta_luma_weight_l0[ i] se(v)    luma_offset_l0[ i ] se(v)   }   if( chroma_weight_l0_flag[ i] )    for( j = 0; j < 2; j++ ) {     delta_chroma_weight_l0[ i ][ j ]se(v)     delta_chroma_offset_l0[ i ][ j ] se(v)    }  } num_l1_weighted_ref_pics ue(v)  for( i = 0; i <num_l1_weighted_ref_pics; i++ )   luma_weight_l1_flag[ i ] u(1)  if(ChromaArrayType != 0 )   for( i = 0; i < NumRefIdxActive[ 1 ]; i++ )   chroma_weight_l1_flag[ i ] u(1)  for( i = 0; i < NumRefIdxActive[ 1]; i++ ) {   if( luma_weight_l1_flag[ i ] ) {    delta_luma_weight_l1[ i] se(v)    luma_offset_l1[ i ] se(v)   }   if( chroma_weight_l1_flag[ i] )    for( j = 0; j < 2; j++ ) {     delta_chroma_weight_l1[ i ][ j ]se(v)     delta_chroma_offset_l1[ i ][ j ] se(v)    }  } }

TABLE 12 num_l0_weighted_ref_pics specifies the number of referencepictures in reference picture list 0 that are weighted. The value ofnum_l0_weighted_ref_pics shall ranges from 0 to MaxDecPicBuffMinus1 +14, inclusive. num_l1_weighted_ref_pics specifies the number ofreference pictures in reference picture list 1 that are weighted. Thevalue of num_l1_weighted_ref_pics shall ranges from 0 toMaxDecPicBuffMinus1 + 14, inclusive.

Referring to Table 11 and Table 12, num_10_weighted_ref_pics mayindicate the number of weighted reference pictures in reference picturelist 0. The value of num_10_weighted_ref_pics is included in a rangefrom 0 to MaxDecPicBuffMinus1+14.

num_11 weighted_ref_pics may indicate the number of weighted referencepictures in reference picture list 1. The value of num_11weighted_ref_pics is included in a range from 0 toMaxDecPicBuffMinus1+14.

The value of luma_weight_10_flag[i] equal to 1 indicates that there areweighting factors for a luma component of list 0 (L0) prediction usingRefPicList[0] [i].

The value of chroma_weight_10_flag[i] equal to 1 indicates that thereare weighting factors for chroma prediction values of L0 predictionusing RefPicList[0][i]. The value of chroma_weight_10_flag[i] equal to 0indicates that these weighting factors do not exist.

The value of luma_weight_11_flag[i] equal to 1 indicates that there areweighting factors for a luma component of list 1 (L1) prediction usingRefPicList[0][i].

chroma_weight_11_flag[i] indicates that there are weighting factors forchroma prediction values of L1 prediction using RefPicList[0][i]. Thevalue of chroma_weight_10_flag[i] equal to 0 indicates that theseweighting factors do not exist.

For example, when weighted prediction is applied to the current block,the encoding apparatus may generate number information on weightedreference pictures in a reference picture list of the current blockbased on the weighted prediction. The number information may refer tonumber information on weightings signaled for items (reference pictures)in an L0 reference picture list and/or an L1 reference picture list.That is, the value of the number information may be equal to the numberof weighted reference pictures in the reference picture list (L0 and/orL1). Thus, when the value of the number information is n, the predictionweighted table syntax may include n weighting factor-related flags forthe reference picture list. The weighting factor-related flags maycorrespond to luma_weight_10_flag, luma_weight_11_flag,chroma_weight_10_flag, and/or chroma_weight_10_flag of Table 11.Weightings for the current picture may be derived based on the weightingfactor-related flags.

When weighted bi-prediction is applied to the current block, theprediction weighted table syntax may independently include numberinformation on weighted reference pictures in the L1 reference picturelist and number information on weighted reference pictures in the L0reference picture list as shown in Table 11. The weightingfactor-related flags may be independently included for each of thenumber information on the weighted reference pictures in the L1reference picture list and the number information on the weightedreference pictures in the L0 reference picture list. That is, theprediction weighed table syntax may include the same number ofluma_weight_10_flag and/or chroma_weight_10_flag as the number ofweighted reference pictures in the L0 reference picture list and mayinclude the same number of luma_weight_11_flags and/orchroma_weight_11_flags as the number of weighted reference pictures inthe L1 reference picture list.

The encoding apparatus may encode image information including the numberinformation and the weighting factor-related flags and may output theencoded image information in the form of a bitstream. Here, the numberinformation and the weighting factor-related flags may be included inthe prediction weighted table syntax in the image information as shownin Table 11. The prediction weighted table syntax may be included in apicture header in the image information or in a slice header in theimage information. To indicate whether the prediction weighted tablesyntax is included in the picture header, that is, to indicate whetherinformation on the weighted prediction exists in the picture header, aweighted prediction-related flag may be included in a picture parameterset and/or the picture header. When the weighted prediction-related flagis included in the picture parameter set, the weightedprediction-related flag may correspond to pps_weighted_pred_flag ofTable 5. When the weighted prediction-related flag is included in thepicture header, the weighted prediction-related flag may correspond topic_weighted_pred_flag of Table 7. Alternatively, bothpps_weighted_pred_flag and pic_weighted_pred_flag may be included in theimage information to indicate whether the prediction weighted tablesyntax is included in the picture header.

When the weighted prediction-related flag is parsed from the bitstream,the decoding apparatus may parse the prediction weighted table syntaxfrom the bitstream based on the parsed flag. The weightedprediction-related flag may be parsed from the picture parameter setand/or the picture header of the bitstream. In other words, the weightedprediction-related flag may include pps_weighted_pred_flag and/orpic_weighted_pred_flag. When the values of pps_weighted_pred_flag and/orpic_weighted_pred_flag are 1, the decoding apparatus may parse theprediction weighted table syntax from the picture header of thebitstream.

When the prediction weighted table syntax is parsed from the pictureheader (when the values of pps_weighted_pred_flag and/orpic_weighted_pred_flag are 1), the decoding apparatus may apply theinformation on the weighted prediction included in the predictionweighted table syntax to all slices in the current picture. In otherwords, when the prediction weighted table syntax is parsed from thepicture header, all slices in the picture associated with the pictureheader may have the same reference picture list.

The decoding apparatus may parse the number information on the weightedreference pictures in the reference picture list of the current blockbased on the prediction weighted table syntax. The value of the numberinformation may be equal to the number of weighted reference pictures inthe reference picture list. When weighted bi-prediction is applied tothe current block, the decoding apparatus may independently parse thenumber information on the weighted reference pictures in the L1reference picture list and the number information on the weightedreference pictures in the L0 reference picture list from the predictionweighted table syntax.

The decoding apparatus may parse the weighting factor-related flags forthe reference picture list from the prediction weighted table syntaxbased on the number information. The weighting factor-related flags maycorrespond to luma_weight_10_flag, luma_weight_11_flag,chroma_weight_10_flag, and/or chroma_weight_10_flag of Table 11. Forexample, when the value of the number information is n, the decodingapparatus may parse n weighting factor-related flags from the predictionweighted table syntax. The decoding apparatus may derive weightings forthe reference pictures of the current block based on the weightingfactor-related flags, and may perform weighted prediction on the currentblock based on the weightings, thereby generating or deriving predictionsamples. Subsequently, the decoding apparatus may generate or derivereconstructed samples for the current block based on the predictionsamples, and may reconstruct the current picture based on thereconstructed samples.

In another embodiment, for weighted prediction in inter prediction, apicture header may include syntax elements shown below in Table 13, andthe semantics of the syntax elements may be as shown below in Table 14.

TABLE 13 Descriptor picture_header_rbsp( ) {  non_reference_picture_flagu(1) ...  pic_weighted_pred_flag u(1)  pic_rpl_present_flag u(1)  if(pic_rpl_present_flag ) {   for( i = 0; i < 2; i++ ) {    if(num_ref_pic_lists_in_sps[ i ] > 0 && !pps_ref_pic_list_sps_idc[ i ] &&      ( i = = 0 || ( i = = 1 && rpl1_idx_present_flag ) ) )    pic_rpl_sps_flag[ i ] u(1)    if( pic_rpl_sps_flag[ i ] ) {     if(num_ref_pic_lists_in_sps[ i ] > 1 &&        ( i = = 0 || ( i = = 1 &&rpl1_idx_present_flag ) ) )      pic_rpl_idx[ i ] u(v)    } else    ref_pic_list_struct( i, num_ref_pic_lists_in_sps[ i ] )    for( j =0; j < NumLtrpEntries[ i ][ RplsIdx[ i ] ]; j++ ) {     if(ltrp_in_slice_header_flag[ i ][ RplsIdx ] ] )      pic_poc_lsb_lt[ i ][j ] u(v)     pic_delta_(——)poc_msb_present_flag[ i ][ j ] u(1)     if(pic_delta_poc_msb_present_flag[ i ][ j ] )     pic_delta_poc_msb_cycle_lt[ i ][ j ] ue(v)   if( (pic_weighted_pred_flag && ( nal_unit_type != IDR_W_RADL && nal_unit_type!= IDR_N_LP) ) )    pred_weight_table( )    }   }  } ... }

TABLE 14 pic_weighted_pred_flag equal to 0 specifies that weightedprediction is not applied to P or B slices referring to the PH.pic_weighted_pred_flag equal to 1 specifies that weighted prediction isapplied to P or B slices referring to the PH. Whensps_weighted_pred_flag is equal to 0, the value ofpic_weighted_pred_flag shall be equal to 0. NOTE- It is constraint thatall slices have the same RPL if the pred_weighted_table( ) is present inthe PH.

Referring to Table 13 and Table 14, when the value ofpic_weighted_pred_flag equal to 0 may indicate that weighted predictionis not applied to P or B slices referring to the picture header. Thevalue of pic_weighted_pred_flag equal to 1 may indicate that weightedprediction is applied to P or B slices referring to the picture header.When the value of sps_weighted_pred_flag is 0, the value ofpic_weighted_pred_flag is 0.

A slice header may include syntax elements shown below in Table 15.

TABLE 15 Descriptor slice_header( ) {  slice_pic_order_cnt_lsb u(v) ... if( !pic_rpl_present_flag &&( ( nal_unit_type != IDR_W_RADL &&nal_unit_type !=        IDR_N_LP ) || sps_idr_rpl_present_flag ) ) {  for( i = 0; i < 2; i++ ) {    if( num_ref_pic_lists_in_sps[ i ] > 0 &&!pps_ref_pic_list_sps_idc[ i ] &&          ( i = = 0 || ( i = = 1 &&rpl1_idx_present_flag ) ) )     slice_rpl_sps_flag[ i ] u(1)    if(slice_rpl_sps_flag[ i ] ) {     if( num_ref_pic_lists_in_sps[ i ] > 1 &&        ( i = = 0 || ( i = = 1 && rpl1_idx_present_flag ) ) )      slice_rpl_idx[ i ] u(v)    } else     ref_pic_list_struct( i,num_ref_pic_lists_in_sps[ i ] )    for( j = 0; j < NumLtrpEntries[ i ][RplsIdx[ i ] ]; j++ ) {     if( ltrp_in_slice_header_flag[ i ][ RplsIdx[i ] ] )      slice_poc_lsb_lt[ i ][ j ] u(v)    slice_delta_poc_msb_present_flag[ i ][ j ] u(1)     if(slice_delta_poc_msb_present_flag[ i ][ j ] )       slice_delta_poc_msb_cycle_lt[ i ][ j ] ue(v)      }     }    }   if( pic_rpl_present_flag || ( ( nal_unit_type != IDR_W_RADL &&  nal_unit_type !=       IDR_N_LP ) || sps_idr_rpl_present_flag ) ) {    if( ( slice_type != I && num_ref_entries[ 0 ][ RplsIdx[ 0 ] ] > 1 )||      ( slice_type = = B && num_ref_entries[ 1 ][ RplsIdx[ 1 ] ] > 1 )) {      num_ref_idx_active_override_flag u(1)      if(num_ref_idx_active_override_flag )       for( i = 0; i < ( slice_type == B ? 2: 1 ); i++ )        if( num_ref_entries[ i ][ RplsIdx[ i ] ] > 1)         num_ref_idx_active_minus1[ i ] ue(v)     }    }    if(slice_type != I ) {     if( cabac_init_present_flag )     cabac_init_flag u(1)     if( pic_temporal_mvp_enabled_flag ) {     if( slice_type = = B && !pps_collocated_from_l0_idc )      collocated_from_l0_flag      if( ( collocated_from_l0_flag &&NumRefIdxActive[ 0 ] > 1 ) ||       ( !collocated_from_l0_flag &&NumRefIdxActive[ 1 ] > 1 ) )       collocated_ref_idx ue(v)     }    if( (!pic_weighted_pred_flag && slice_type = = P ) ||      (pps_weighted_bipred_flag && slice_type = = B ) )      pred_weight_table()    }

Referring to Table 15, the weighted prediction-related flag(pic_weighted_pred_flag) may indicate whether the prediction weightedtable syntax (information on the weighted prediction) exists in thepicture header or the slice header. The value of pic_weighted_pred_flagequal to 1 may indicate that the prediction weighted table syntax(information on the weighted prediction) may exist in the picture headerrather than in the slice header. The value of pic_weighted_pred_flagequal to 0 may indicate that the prediction weighted table syntax(information on the weighted prediction) may exist in the slice headerrather than in the picture header. Although Table 13 and Table 14 showthat the weighted prediction-related flag is signaled in the pictureheader, the weighted prediction-related flag may be signaled in thepicture parameter set.

For example, when weighted prediction is applied to the current block,the encoding apparatus performs the weighted prediction and may encodeimage information including a weighted prediction-related flag and aprediction weighted table syntax based on the weighted prediction. Here,the encoding apparatus may determine the value of the flag as 1 when theprediction weighted table syntax is included in the picture header ofthe image information, and may determine the value of the flag as 0 whenthe prediction weighted table syntax is included in the slice header ofthe image information. When the value of the flag is 1, information onthe weighted prediction included in the prediction weighted table syntaxmay be applied to all slices in the current picture. When the value ofthe flag is 0, the information on the weighted prediction included inthe prediction weighted table syntax may be applied to a slice(s)associated with the slice header among the slices in the currentpicture. Accordingly, when the prediction weighted table syntax isincluded in the picture header, all slices in the picture associatedwith the picture header may have the same reference picture list, andwhen the prediction weighted table syntax is included in the sliceheader, the slices associated with the slice header may have the samereference picture list.

The prediction weighted table syntax may include number information onweighted reference pictures in a reference picture list of the currentblock, a weighting factor-related flag, and the like. As describedabove, the number information may refer to number information onweightings signaled for items (reference pictures) in an L0 referencepicture list and/or an L1 reference picture list, and the value of thenumber information may be equal to the number of weighted referencepictures in the reference picture list (L0 and/or L1). Thus, when thevalue of the number information is n, the prediction weighted tablesyntax may include n weighting factor-related flags for the referencepicture list. The weighting factor-related flags may correspond toluma_weight_10_flag, luma_weight_11_flag, chroma_weight_10_flag, and/orchroma_weight_10_flag of Table 11.

When weighted bi-prediction is applied to the current block, theencoding apparatus may generate a prediction weighted table syntaxincluding number information on weighted reference pictures in the L1reference picture list and number information on weighted referencepictures in the L0 reference picture list. The prediction weighted tablesyntax may include weighting factor-related flags independently for eachof the number information on the weighted reference pictures in the L1reference picture list and the number information on the weightedreference pictures in the L0 reference picture list. That is, theprediction weighed table syntax may include the same number ofluma_weight_10_flag and/or chroma_weight_10_flag as the number ofweighted reference pictures in the L0 reference picture list and mayinclude the same number of luma_weight_11_flags and/orchroma_weight_11_flags as the number of weighted reference pictures inthe L1 reference picture list.

When the weighted prediction-related flag is parsed from the bitstream,the decoding apparatus may parse the prediction weighted table syntaxfrom the bitstream based on the parsed flag. The weightedprediction-related flag may be parsed from the picture parameter setand/or the picture header of the bitstream. In other words, the weightedprediction-related flag may correspond to pps_weighted_pred_flag and/orpic_weighted_pred_flag. When the value of the weightedprediction-related flag is 1, the decoding apparatus may parse theprediction weighted table syntax from the picture header of thebitstream. When the value of the weighted prediction-related flag is 0,the decoding apparatus may parse the prediction weighted table syntaxfrom the slice header of the bitstream.

When the prediction weighted table syntax is parsed from the pictureheader, the decoding apparatus may apply the information on the weightedprediction included in the prediction weighted table syntax to allslices in the current picture. In other words, when the predictionweighted table syntax is parsed from the picture header, all slices inthe picture associated with the picture header may have the samereference picture list. When the prediction weighted table syntax isparsed from the slice header, the decoding apparatus may apply theinformation on the weighted prediction included in the predictionweighted table syntax to a slice(s) associated with the slice headeramong the slices in the current picture. In other words, when theprediction weighted table syntax is parsed from the picture header, theslices associated with the slice header may have the same referencepicture list.

The decoding apparatus may parse the number information on the weightedreference pictures in the reference picture list of the current blockbased on the prediction weighted table syntax. The value of the numberinformation may be equal to the number of weighted reference pictures inthe reference picture list. When weighted bi-prediction is applied tothe current block, the decoding apparatus may independently parse thenumber information on the weighted reference pictures in the L1reference picture list and the number information on the weightedreference pictures in the L0 reference picture list from the predictionweighted table syntax.

The decoding apparatus may parse the weighting factor-related flags forthe reference picture list from the prediction weighted table syntaxbased on the number information. The weighting factor-related flags maycorrespond to luma_weight_10_flag, luma_weight_11_flag,chroma_weight_10_flag, and/or chroma_weight_10_flag described above. Forexample, when the value of the number information is n, the decodingapparatus may parse n weighting factor-related flags from the predictionweighted table syntax. The decoding apparatus may derive weightings forthe reference pictures of the current block based on the weightingfactor-related flags, and may perform inter prediction on the currentblock based on the weightings, thereby generating or deriving predictionsamples. The decoding apparatus may generate or derive reconstructedsamples for the current block based on the prediction samples, and maygenerate a reconstructed picture for the current picture based on thereconstructed samples.

In still another embodiment, a prediction weighted table syntax mayinclude syntax elements shown below in Table 16, and the semantics ofthe syntax elements may be as shown below in Table 17.

TABLE 16 Descriptor pred_weight_table( ) {  luma_log2_weight_denom ue(v) if( ChromaArrayType != 0 )   delta_chroma_log2_weight_denom se(v) num_weighted_ref_pics_minus1  for( i = 0; i <=num_weighted_ref_pics_minus1; i++ )   pic_poc_abs_delta[ i ] ue(v)   if(pic_poc_abs_delta[ i ] )    pic_poc_delta_sign[ i ] u(1)  luma_weight_flag[ i ] u(1)  if( ChromaArrayType != 0 )   for( i = 0; i<= num_weighted_ref_pics_minus1; i++ )    chroma_weight_flag[ i ] u(1) for( i = 0; i <= num_weighted_ref_pics_minus1; i++ ) {   if(luma_weight_flag[ i ] ) {    delta_luma_weight[ i ] se(v)   luma_offset[ i ] se(v)   }   if( chroma_weight_flag[ i ] )    for( j= 0; j < 2; j++ ) {     delta_chroma_weight[ i ][ j ] se(v)    delta_chroma_offset[ i ][ j ] se(v)    }  } }

TABLE 17 luma_log2_weight_denom is the base 2 logarithm of thedenominator for all luma weighting factors. The value ofluma_log2_weight_denom shall be in the range of 0 to 7, inclusive.delta_chroma_log2_weight_denom is the difference of the base 2 logarithmof the denominator for all chroma weighting factors. Whendelta_chroma_log2_weight_denom is not present, it is inferred to beequal to 0. The variable ChromaLog2WeightDenom is derived to be equal toluma_log2_weight_denom + delta_chroma_log2_weight_denom and the valueshall be in the range of 0 to 7, inclusive. num_weighted_ref_pics_minus1plus 1 specifies the number of reference pictures in reference picturesthat are weighted. The value of num_weighted_ref_pics shall ranges from0 to MaxDecPicBuffMinus1 + 14, inclusive. It is a conformance constraintthat the value of num_weighted_ref_pics_minus1 plus 1 shall not be lessthan the sum of unique active reference pictures in the referencepicture lists L0 and L1 of all slices of pictures associated with thepicture header containing the weighted prediction table.pic_poc_abs_delta[ i ] specifies the absolute POC difference between thecurrent picture and the i-th weighted reference picture.pic_poc_delta_sign[ i ] specifies the sign of POC difference between thecurent picture and the i-th weighted reference picture. Ifpic_poc_delta_sign[ i ] is equal to 0, the correspondingpic_poc_abs_delta[ i ] has a positive value, otherwise, thecorresponding pic_poc_abs_delta[ i ] has a negative value.luma_weight_flag[ i ] equal to 1 specifies that weighting factors forthe luma component in the reference picture associated withDeltaPocWeightedRefPic[ i ] are present. luma_weight_flag[ i ] equal to0 specifies that these weighting factors are not present.chroma_weight_flag[ i ] equal to 1 specifies that weighting factors forthe chroma component in the reference picture associated withDeltaPocWeightRefPic[ i ] are present. chroma_weight_flag[ i ] equal to0 specifies that these weighting factors are not present. Whenchroma_weight_flag[ i ] is not present, it is inferred to be equal to 0.delta_luma_weight[ i ] is the difference of the weighting factor appliedto the luma prediction value for in the reference picture associatedwith DeltaPocWeightedRefPic[ i ]. luma_offset[ i ] is the additiveoffset applied to the luma predicition value for in the referencepicture associated with DeltaPocWeightedRefPic[ i ]list 0 predictionusing RefPicList[ 0 ][ i ]. The value of luma_offset_l0[ i ] shall be inthe range of −128 to 127, inclusive. When luma_weight_flag[ i ] is equalto 0, luma_offset[ i ] is inferred to be equal to 0.delta_chroma_weight_l0[ i ][ j ] is the difference of the weightingfactor applied to the chroma prediction values for in the referencepicture associated with DeltaPocWeightedRefPic[ i ] with j equal to 0for Cb and j equal to 1 for Cr. delta_chroma_offset[ i ][ j ] is thedifference of the additive offset applied to the chroma predictionvalues for in the reference picture associated withDeltaPocWeightedRefPic[ i ] with j equal to 0 for Cb and j equal to 1for Cr.

In Table 16 and Table 17, when pic_poc_delta_sign[i] does not exist,pic_poc_delta_sign[i] is inferred as 0. DeltaPocWeightedRefPic[i] wherei is included in a range from 0 to num_weighted_ref_pics_minus1 may bederived as follows.DeltaPocWeightedRefPic[i]=pic_poc_abs_delta[i]*(1−2*pic_poc_delta_sign[i])  [Equation1]

ChromaWeight[i][j] may be derived as(1<<ChromaLog2WeightDenom)+delta_chroma_weight [i][j]. When the value ofchroma_weight_flag[i] is 1, the value of delta_chroma_weight[i][j] isincluded in a range from −128 to 127. When the value ofchroma_weight_flag[i] is 0, ChromaWeight[i][j] may be derived as2ChromaLog2WeightDenom.

ChromaOffset[i] [j] may be derived as follows.

[Equation 2] ChromaOffset[ i ][ j ] = Clip3( −128, 127,  ( 128 + deltachroma offset[ i ][ j ] −  ( ( 128 * ChromaWeight[ i ][ j ] ) >>ChromaLog2WeightDenom ) ) )

The value of delta chroma offset[i][j] is included in a range from−4*128 to 4*127. When the value of chroma_weight_flag[i] is 0, the valueof ChromaOffset[i][j] is inferred as 9.

sumWeightFlags may be derived as the sum of luma_weight_flag[i]+2*chroma_weight_flag [i]. i is included in a range from 0 tonum_weighted_ref_pics_minus1. When slice_type is P, sumWeightL0Flags isless than or equal to 24.

When a current slice is a P slice or a B slice and the value ofpic_weighted_pred_flag is 1, L0ToWeightedRefIdx[i] may represent mappingbetween an index in a list of weighted reference pictures and an ithreference picture L0. i is included in a range from 0 toNumRefIdxActive[0]−1, and may be derived as follows.

[Equation 3] for( i = 0; i < NumRefIdxActive[ 0 ]; i++ ) { L0ToWeightedRefIdx[ i ] = −1  for( j = 0; L0ToWeightedRefIdx[ i ] = =−1  && j <= num_weighted_ref_pics_minus1; j++ )   if( RefPicPocList[ 0][ i ] = =   PicOrderCntVal − DeltaPocWeightedRefPic[ j ] )  L0ToWeightedRefIdx[ i ] = j }

When the current slice is a B slice and the value ofpic_weighted_pred_flag is 1, L1ToWeightedRefIdx[i] may represent mappingbetween an index in the list of weighted reference pictures and an ithactive reference picture L1. i is included in a range from 0 toNumRefIdxActive[1]−1, and may be derived as follows.

[Equation 4] for( i = 0; i < NumRefIdxActive[ 1 ]; i++ ) { L1ToWeightedRefIdx[ i ] = −1  for( j = 0; L1ToWeightedRefIdx[ i ] = =−1  && j <= num_weighted_ref_pics_minus1; j++ )   if( RefPicPocList[ 1][ i ] = =   PicOrderCntVal − DeltaPocWeightedRefPic[ j ] )   L1ToWeightedRefIdx[ i ] = j }

When luma_weight_10_flag[i] occurs, luma_weight_10_flag[i] is replacedwith luma_weight_flag[L0ToWeightedRefIdx[i]], and whenluma_weight_11_flag[i] occurs, luma_weight_11_flag[i] is replaced withluma_weight_flag[L1ToWeightedRefIdx[i]].

When LumaWeightL0[i] occurs, LumaWeightL0[i] is replaced withLumaWeight[L0ToWeightedRefIdx[i]], and when LumaWeightL1[i] occurs,LumaWeightL1[i] is replaced with LumaWeight[L1ToWeightedRefIdx [i]].

When luma_offset_10[i] occurs, luma_offset_10[i] is replaced with lumaoffset[L0ToWeightedRefIdx[i]], and when luma_offset_11[i] occurs,luma_offset_11[i] is replaced with luma_offset[L1ToWeightedRefIdx [i]].

When ChromaWeightL0[i] occurs, ChromaWeightL0[i] is replaced withChromaWeight [L0ToWeightedRefIdx[i]], and when ChromaWeightL1[i] occurs,ChromaWeightL1[i] is replaced with ChromaWeight[L1ToWeightedRefIdx [i]].

In yet another embodiment, a slice header syntax may include syntaxelements shown below in Table 18, and the semantics of the syntaxelements may be as shown below in Table 19.

TABLE 18 Descriptor slice_header( ) {  ...   if( (pps_weighted_pred_flag && slice_type = = P ) ||    (pps_weighted_bipred_flag && slice_type = = B )    )   slice_weight_pred_present_flag u(1)    if(slice_weight_pred_present_flag )     pred_weight_table( )  }  ... }

TABLE 19 slice_weight_pred_present_flag equal to 1 specifies that weightprediction table is present in the slice header.slice_weight_pred_present_flag equal to 0 specifies that weightprediction table is not present in the slice header.

Referring to Table 18 and Table 19, a flag indicating whether aprediction weighted table syntax exists in a slice header may besignaled. The flag may be signaled in the slice header and may bereferred to as slice_weight_pred_present_flag.

The value of slice_weight_pred_present_flag equal to 1 may indicate thatthe prediction weighted table syntax exists in the slice header. Thevalue of slice_weight_pred_present_flag equal to 0 may indicate that theprediction weighted table syntax does not exist in the slice header.That is, slice_weight_pred_present_flag equal to 0 may indicate that theprediction weighted table syntax exists in a picture header.

In still another embodiment, a prediction weighted table syntax isparsed from a slice header, but an adaptation parameter set includingsyntax elements shown below in Table 20 may be signaled.

TABLE 20 Descriptor adaptation_parameter_set_rbsp( ) { adaptation_parameter_set_id u(5)  aps_params_type u(3)  if(aps_params_type = = ALF_APS )   alf_data( )  else if( aps_params_type == LMCS_APS )   lmcs_data( )  else if( aps_params_type = = SCALING_APS )  scaling_list_data( )   else if( aps_params_type = = PRED_WEIGHT_APS )    pred_weight_data( )  aps_extension_flag u(1)  if( aps_extension_flag)   while( more_rbsp_data( ) )    aps_extension_data_flag u(1) rbsp_trailing_bits( ) }

Each APS RBSP needs to be available for a decoding process before beingincluded for reference in at least one access unit having TemporalIdless than or equal to TemporalId of a coded slice NAL unit that refersto the APS RBSP or is provided through a external method.

aspLayerId may be referred to as nuh_layer_id of an APS NAL unit. When alayer with nuh_layer_id equal to aspLayerId is an independent layer(i.e., when vps_independent_layer_flag[GeneralLayerIdx[aspLayerId]] is1), an APS NAL unit including an APS RBSP has the same nuh_layer_id asnuh_layer_id of a coded slice NAL unit referring to the APS RBSP.Otherwise, the APS NAL unit including the APS RBSP has the samenuh_layer_id as nuh_layer_id of the coded slice NAL unit referring tothe APS RBSP or nuh_layer_id of a direct dependent layer of a layerincluding the coded slice NAL unit referring to the APS RBSP.

All APS NAL units having a specific value of adaptation_parameter_set_idand a specific value of aps_params_type in an access unit have the samecontent.

adaptation_parameter_set_id provides an identifier for the APS so thatother syntax elements may refer to the identifier.

When aps_params_type is ALF_APS, SCALING_APS, or PRED_WEIGHT_APS, thevalue of adaptation_parameter_set_id is included in a range from 0 to 7.

When aps_params_type is LMCS_APS, the value ofadaptation_parameter_set_id is included in a range from 0 to 3.

aps_params_type indicates the type of APS parameters included in the APSas shown below in Table 21. When the value of aps_params_type is 1(LMCS_APS), the value of adaptation_parameter_set_id is included in arange from 0 to 3.

TABLE 21 Name of Type of APS aps_params_type aps_params_type parameters0 ALF_APS ALF parameters 1 LMCS_APS LMCS parameters 2 SCALING_APSScaling list parameters 3 PRED_WEIGHT_APS Prediction weighted parameters4 . . . 7 Reserved Reserved

Each type of APS uses a separate value space foradaptation_parameter_set_id.

An APS NAL unit (having a specific value of adaptation_parameter_set_idand a specific value of aps_params_type) may be shared between pictures,and different slices within a picture may refer to different ALF APSs.

The value of aps_extension_flag equal to 0 indicates that an apsextension data flag syntax element does not exist in the APS RBSP syntaxstructure. The value of aps_extension_flag equal to 1 indicates that theaps_extension_data_flag syntax element exists in the APS RBSP syntaxstructure.

aps_extension_data_flag may have a random value.

As described above, new aps_params_type (PRED_WEIGHT_APS) may be addedto an existing type. Further, the slice header may be modified to signalthe APS ID instead of pred_weight_table( ) as shown below in Table 22.

TABLE 22 Descriptor slice_header( ) {  slice_pic_parameter_set_id ue(v)...   if( ( pps_weighted_pred_flag && slice_type = = P ) ||    (pps_weighted_bipred_flag && slice_type = = B )    )   slice_pred_weight_aps_id u(3) ... }

In Table 22, slice_pred_weight_aps_id indicatesadaptation_parameter_set_id of a prediction weighted table APS.TemporalId of an APS NAL unit having the same aps_params_type asPRED_WEIGHT_APS and the same adaptation_parameter_set_id asslice_pred_weight_aps_id is less than or equal to TemporalId of thecoded slice NAL unit.

When a slice_pred_weight_aps_id syntax element exists in the sliceheader, the value of slice_pred_weight_aps_id is the same for all slicesof the picture.

In this case, a prediction weighted table syntax shown below in Table 23may be signaled.

TABLE 23 Descriptor pred_weight_table( ) {  luma_log2_weight_denom ue(v) if( ChromaArrayType != 0 )   delta_chroma_log2_weight_denom se(v)   num_lists_active_flag u(1)   for( i = 0; i < (num_lists_active_flag ?1 : 2); i++ )    NumRefIdxActive[i] ue(v)  for( i = 0; i <NumRefIdxActive[ 0 ]; i++ )   luma_weight_l0_flag[ i ] u(1)  if(ChromaArrayType != 0 )   for( i = 0; i < NumRefIdxActive[ 0 ]; i++ )   chroma_weight_l0_flag[ i ] u(1)  for( i = 0; i < NumRefIdxActive[ 0]; i++   if( luma_weight_l0_flag[ i ] ) {     delta_luma_weight_l0[ i ]se(v)     luma_offset_l0[ i ] se(v)   }   if( chroma_weight_l0_flag[ i ])    for( j = 0; j < 2; j++ ) {     delta_chroma_weight_l0[ i ][ j ]se(v)     delta_chroma_offset_l0[ i ][ j ] se(v)    }  } if(num_lists_active_flag) {   for( i = 0; i < NumRefIdxActive[ 1 ]; i++)    luma_weight_l1_flag[ i ] u(1)   if( ChromaArrayType != 0 )    for(i = 0; i < NumRefIdxActive[ 1 ] ; i++ )     chroma_weight_l1_flag[ i ]u(1)   for( i = 0; i < NumRefIdxActive[ 1 ]; i++ ) {    if(luma_weight_l1_flag[ i ] ) {     delta_luma_weight_l1[ i ] se(v)    luma_offset_l1[ i ] se(v)    }    if( chroma_weight_l1_flag[ i ] )    for( j = 0; j < 2; j++ ) {      delta_chroma_weight_l1[ i ][ j ]se(v)      delta_chroma_offset_l1[ i ][ j ] se(v)     }   }  } }

In Table 23, the value of num_lists_active_flag equal to 1 may indicatethat prediction weighted table information is signaled for one referencepicture list. The value of num_lists_active_flag equal to 0 may indicatethat prediction weight table information for two reference picture listsL0 and L1 is not signaled.

numRefIdxActive[i] may be used to indicate the number of activereference indices. The value of numRefIdxActive[i] is in a range from 0to 14.

The syntax of Table 23 indicates whether information on one or two listsis parsed in the APS when num_lists_active_flag is parsed.

Instead of Table 23, a prediction weighted table syntax shown below inTable 24 may be used.

TABLE 24 Descriptor pred_weight_table( ) {  luma_log2_weight_denom ue(v) if( ChromaArrayType != 0 )   delta_chroma_log2_weight_denom se(v) num_lists_active_flag u(1)  for( i = 0; i < NumRefIdxActive[ 0 ]; i++ )  luma_weight_l0_flag[ i ] u(1)  if( ChromaArrayType != 0 )   for( i =0; i < NumRefIdxActive[ 0 ]; i++ )    chroma_weight_l0_flag[ i ]  for( i= 0; i < NumRefIdxActive[ 0 ]; i++ ) {   if( luma_weight_l0_flag[ i ] ){    delta_luma_weight_l0[ i ] se(v)    luma_offset_l0[ i ] se(v)   }  if( chroma_weight_l0_flag[ i ] )    for( j = 0; j < 2; j++ ) {    delta_chroma_weight_l0[ i ][ j ] se(v)     delta_chroma_offset_l0[ i][ j ] se(v)    }  }  if(num_lists_active_flag) {   for( i = 0; i <NumRefIdxActive[ 1 ]; i++ )    luma_weight_l1_flag[ i ] u(1)   if(ChromaArrayType != 0 )    for( i = 0; i < NumRefIdxActive[ 1 ]; i++    chroma_weight_l1_flag[ i ] u(1)   for( i = 0; i < NumRefIdxActive[1]; i++ ) {    if( luma_weight_l1_flag[ i ] ) {    delta_luma_weight_l1[ i ] se(v)     luma_offset_l1[ i ] se(v)    }   if( chroma_weight_l1_flag[ i ] )     for( j = 0; j < 2; j++ ) {     delta_chroma_weight_l1[ i ][ j ] se(v)      delta_chroma_offset_l1[i ][ j ] se(v)     }   }  } }

In Table 24, the value of num_lists_active_flag equal to 1 may indicatethat prediction weight table information is signaled for one referencepicture list. The value of num_lists_active_flag equal to 0 may indicatethat prediction weight table information for two reference picture listsis not signaled.

In still another embodiment, a picture parameter set syntax may includesyntax elements shown below in Table 25, and the semantics of the syntaxelements may be as shown below in Table 26.

TABLE 25 Descriptor pic_parameter_set_rbsp( ) { pps_pic_parameter_set_id ue(v) ...  pps_weighted_pred_flag u(1) pps_weighted_bipred_flag u(1)  if(pps_weighted_pred_flag ||pps_weighted_bipred_flag  )   weighted_pred_table_present_in_ph_flagu(1) ... }

TABLE 26 pps_weighted_flag_equal to 0 specifies that weighted predictionis not applied to P or B slices referring to the PPS.pps_weighted_pred_flag equal to 1 specifies that weighted prediction isapplied to P or B slices referring to the PPS. Whensps_weighted_pred_flag is equal to 0, value of pps_weighted_pred_flagshall be equal to 0. pps_weighted_bipred_flag equal to 0 specifies thatexplicit weighted prediction is not applied to B slices referring to thePPS. pps_weighted_bipred_flag equal to 1 specifies that explicitweighted prediction is applied to B slices referring to the PPS. Whensps_weighted_bipred_flag is equal to 0, the value ofpps_weighted_bipred_flag shall be equal to 0.weighted_pred_table_present_in_ph_flag equal to 1 specifies thatweighted prediction table is not present in the slice headers referringto the PPS but may be present in the PHs referring to the PPS.weighted_pred_table_present_in_ph_flag equal to 0 specifies thatweighted prediction table is not present in the PHs referring to the PPSbut may be present in the slice headers referring to the PPS. When notpresent, the value of weighted_pred_table_present_in_ph_flag is inferredto be equal to 0.

Referring to Table 25 and Table 26, a picture parameter set may includeinformation on a flag indicating whether weighted prediction is appliedto slices referring to the picture parameter set and information on aflag indicating whether information on the weighted prediction exists ina picture header or a slice header.

The information on the flag indicating whether the weighted predictionis applied to the slices referring to the picture parameter set mayinclude a pps_weighted_pred_flag syntax element indicating whether theweighted prediction is applied to P or B slices referring to the pictureparameter set and/or a pps_weighted_bipred_flag syntax elementindicating whether the weighted prediction is applied to B slicesreferring to the picture parameter set.

The information on the flag indicating whether the information on theweighted prediction exists in the picture header or the slice header mayinclude a weighted_pred_table_present_in_ph_flag syntax element, whichmay be included in the picture parameter set when the value of thepps_weighted_pred_flag and/or pps_weighted_bipred_flag syntax elementis 1. When the value of the flag indicating whether the information onthe weighted prediction exists in the picture header or the slice headeris 1, the information on the weighted prediction included in aprediction weighted table syntax may not exist in the slice headerreferring to the picture parameter set but may exist in the pictureheader referring to the picture parameter set. When the value of theflag indicating whether the information on the weighted predictionexists in the picture header or the slice header is 0, the informationon the weighted prediction may not exist in the picture header referringto the picture parameter set but may exist in the slice header referringto the picture parameter set.

In this case, a picture header syntax and a slice header syntax may besignaled as shown below in Table 27 and Table 28, respectively.

TABLE 27 Descriptor picture_header_rbsp( ) { ...  pic_rpl_present_flagu(1)  if( pic_rpl_present_flag ) {   ...  }  if( (pps_weighted_pred_flag || pps_weighted_bipred_flag ) &&    weighted_pred_table_present_in_ph_flag && pic_rpl_present_flag )   pred_weight_table( ) ... }

TABLE 28 Descriptor slice_header( ) {  slice_pic_parameter_set_id ue(v)...  if( ( nal_unit_type != IDR_W_RADL && nal_unit_type != IDR_N_LP ) ||   sps_idr_rpl_present_flag ) {   for( i = 0; i < 2; i++ ) {    if(num_ref_pic_lists_in_sps[ i ] > 0 && ! pps_ref_pic_list_sps_idc[ i ] &&        ( i = = 0 || ( i = = 1 && rpl1_idx_present_flag ) ) )    ref_pic_list_sps_flag[ i ]    if( ref_pic_lift_(——)sps_flag[ i ] ) {    if( num_ref_pic_lists_in_sps[ i ] > 1 &&        ( i = = 0 || ( i = =1 && rpl1_idx_present_flag ) ) )       ref_pic_list_idx[ i ]    } else    ref_pic_list_struct( i, num_ref_pic_lists_in_sps[ i ] )    for( j =0; j < NumLtrpEntries[ i ][ RplsIdx[ i ] ]; j++ ) {     if(ltrp_in_slice_header_flag[ i ][ RplsIdx[ i ] ] )      slice_poc_lsb_lt[i ][ j ]     delta_poc_msb_present_flag[ i ][ j ]     if(delta_poc_msb_present_flag[ i ][ j ] )      delta_poc_msb_cycle_lt[ i ][j ]    }   }   if( ( slice_type != I && num_ref_entries[ 0 ][ RplsIdx[ 0] ] > 1 ) ||    ( slice_type = = B && num_ref_entries[ 1 ][ RplsIdx[ 1 ]] > 1 ) ) {    num_ref_idx_active_override_flag    if(num_ref_idx_active_override_flag )     for( i = 0; i < ( slice_type = =B ? 2: 1 ); i++ )      if( num_ref_entries[ i ][ RplsIdx[ i ] ] > 1 )      num_ref_idx_active_minus1[ i ]   }  } ...   if( (pps_weighted_pred_flag && slice_type = = P ) ||     ( pps weightedbipred flag && slice type = = B ) &&    !weighted_pred_table_present_in_ph_flag)    pred_weight_table( ) ...}

Referring to Table 27, when the value of the flag(pps_weighted_pred_flag and/or pps_weighted_bipred_flag) indicatingwhether the weighted prediction is applied to the slices referring tothe picture parameter set is 1 and the value of the flag(weighted_pred_table_present_in_ph_flag) indicating whether theinformation on the weighted prediction exists in the picture header orthe slice header is 1, the picture header syntax may include theprediction weighted table syntax (pred_weight_table).

Referring to Table 28, when the value of the flag(pps_weighted_pred_flag and/or pps_weighted_bipred_flag) indicatingwhether the weighted prediction is applied to the slices referring tothe picture parameter set is 1 and the value of the flag(weighted_pred_table_present_in_ph_flag) indicating whether theinformation on the weighted prediction exists in the picture header orthe slice header is 0, the slice header syntax may include theprediction weighted table syntax (pred_weight_table). Specifically, whenthe value of pps_weighted_pred_flag is 1, the slice_type is a P slice,and the value of weighted_pred_table_present_in_ph_flag is 0, theprediction weighted table syntax may be included in the slice header.Alternatively, when the value of pps_weighted_bipred_flag is 1, theslice_type is a B slice, and the value ofweighted_pred_table_present_in_ph_flag is 0, the prediction weightedtable syntax may be included in the slice header.

The prediction weighted table syntax may include syntax elements shownbelow in Table 29, and the semantics of the syntax elements may be asshown below in Table 30.

TABLE 29 Descriptor pred_weight_tabte( ) {  luma_log2_weight_denom ue(v) if( ChromaArrayType != 0 )   delta_chroma_log2_weight_denom se(v) if(weighted_pred_table_present_in_ph_flag )   num_l0_weighted_ref_picsue(v)  for( i = 0; i < num_l0_weighted_ref_pics; i++ )  luma_weight_l0_flag[ i ] u(1)  if( ChromaArrayType != 0 )   for( i =0; i < NumRefIdxActive[ 0 ]; i++ )    chroma_weight_l0_flag[ i ] u(1) for( i = 0; i < NamRefIdxActive[ 0 ]; i++ ) {   if(luma_weight_l0_flag[ i ] ) {    delta_luma_weight_l0[ i ] se(v)   luma_offset_l0[ i ] se(v)   }   if( chroma_weight_l0_flag[ i ] )   for( j = 0; j < 2; j++ ) {     delta_chroma_weight_l0[ i ][ j ] se(v)    delta_chroma_offset_l0[ i ][ j ] se(v)    }  } if(weighted_pred_table_present_in_ph_flag )   num_l1_weighted_ref_picsue(v)  for( i = 0; i < num_l1_weighted_pics; i++ )  luma_weight_l1_flag[ i ] u(1)  if( ChromaArrayType != 0 )   for( i =0; i < NumRefIdxActive[ 1 ]; i++ )    chroma_weight_l1_flag[ i ] u(1) for( i = 0; i < NumRefIdxActive[ 1 ]; i++ ) {   if(luma_weight_l1_flag[ i ] ) {    delta_luma_weight_l1[ i ] se(v)   luma_offset_l1[ i ] se(v)   }   if( chroma_weight_l1_flag[ i ] )   for( j = 0; j < 2; j++ ) {     delta_chroma_weight_l1[ i ][ j ] se(v)    delta_chroma_offset_l1[ i ][ j ] se(v)    }  } }

TABLE 30 num_l0_weight_ref_pics specifies the number of referencepicture in reference picture list 0 that are weighted. The value ofnum_l0_weighted_ref_pics shall ranges from 0 to num_ref_entries[ 0 ][PicRplsIdx[ 0 ] ], inclusive. When not present, the value ofnum_l0_weighted_ref_pics is inferred to be equal to NumRefIdxActive[ 0]. num_l1_weighted_ref_pics specifies the number of reference picturesin reference picture list 1 that are weighted. The value ofnum_l1_weighted_ref_pics shall ranges from 0 to num_ref_entries[ 0 ][PicRplsIdx[ 0 ] ], inclusive. When not present, the value ofnum_l0_weighted_ref_pics is inferred to be equal to NumRetIdxActive[ 1].

Referring to Table 29 and Table 30, the prediction weighted table syntaxmay include number information for the weighted prediction. The numberinformation may indicate the number of weighted reference pictures in areference picture list. In other words, the value of the numberinformation may be the same as the number of weighted reference picturesin the reference picture list. The reference picture list may include anL0 reference picture list and an L1 reference picture list. For example,the number information for the weighted prediction may include firstnumber information (num_10_weighted_ref_pics) for the L0 referencepicture list and second number information (num_10_weighted_ref_pics)for the L1 reference picture list. As shown in Table 29, the firstnumber information and the second number information may beindependently parsed from the prediction weighted table syntax. Thenumber information for the weighted prediction may be included in theprediction weighted table syntax based on the flag (e.g., theweighted_pred_table_present_in_ph flag syntax element) indicatingwhether the information on the weighted prediction exists in the pictureheader or the slice header. For example, when the value of the flag(e.g., the weighted_pred_table_present_in_ph flag syntax element)indicating whether the information on the weighted prediction exists inthe picture header or the slice header is 1, the number information forthe weighted prediction may be included in the prediction weighted tablesyntax. When the value of the flag is 0, the first number informationmay be inferred as NumRefIdxActive[0], and the second number informationmay be inferred as NumRefIdxActive[1]. NumRefIdxActive[i] may indicatethe number of (active) reference indices for RPL i used for decoding ofa corresponding slice.

A syntax element (luma_weight_10_flag) indicating whether weightingfactors for L0 prediction exist may be parsed from the predictionweighted table syntax based on the first number information. A syntaxelement (luma_weight_11_flag) indicating whether weighting factors forL1 prediction exist may be parsed from the prediction weighted tablesyntax based on the second number information. For example, when thevalue of the first number information is n, n luma_weight_10_flag syntaxelements may be parsed from the prediction weighted table syntax.Likewise, when the value of the second number information is n, nluma_weight_11_flag syntax elements may be parsed from the predictionweighted table syntax.

FIG. 9 and FIG. 10 schematically illustrate an example of a video/imageencoding method and related components according to an embodiment of thepresent document.

The video/image encoding method disclosed in FIG. 9 may be performed bythe (video/image) encoding apparatus 200 disclosed in FIG. 2 and FIG. 10. Specifically, for example, S900 of FIG. 9 may be performed by thepredictor 220 of the encoding apparatus 200, and S910 may be performedby the residual processor 230 of the encoding apparatus 200. S920 may beperformed by the entropy encoder 240 of the encoding apparatus 200. Thevideo/image encoding method disclosed in FIG. 9 may include theembodiments described above in this document.

Specifically, referring to FIG. 9 and FIG. 10 , the predictor 220 of theencoding apparatus may derive motion information on a current block in acurrent picture based on motion estimation. For example, the encodingapparatus may search for a similar reference block having a highcorrelation in fractional pixel units within a predetermined searchrange in a reference picture using an original block in an originalpicture with respect to the current block, and may thus derive themotion information. Similarity of the block may be derived based on adifference between phase-based sample values. For example, thesimilarity of the block may be calculated based on the sum of absolutedifferences (SAD) between the current block (or template of the currentblock) and the reference block (or template of the reference block). Inthis case, the motion information may be derived based on a referenceblock having the smallest SAD in a search area. The derived motioninformation may be signaled to the decoding apparatus based on an interprediction mode according to various methods.

The predictor 220 of the encoding apparatus may perform weighted(sample) prediction on the current block based on the motion informationon the current block, and may generate prediction samples (predictionblock) and prediction-related information for the current block based onthe weighted prediction (S900). The prediction-related information mayinclude prediction mode information (merge mode, skip mode, or thelike), information on motion information, information on the weightedprediction, and the like. The information on the motion information mayinclude candidate selection information (e.g., a merge index, an mvpflag, or an mvp index) that is information for deriving a motion vector.Further, the information on the motion information may includeinformation on an MVD described above and/or reference picture indexinformation. In addition, the information on the motion information mayinclude information indicating whether L0 prediction, L1 prediction, orbi-prediction is applied. For example, when the slice type of a currentslice is a P slice or a B slice, the predictor 220 may perform weightedprediction on the current block in the current slice. The weightedprediction may be used when not only bi-prediction but alsouni-prediction is applied to the current block.

The residual processor 230 of the encoding apparatus may generateresidual samples and residual information based on the predictionsamples generated by the predictor 220 and the original picture(original block and original samples) (S910). Here, the residualinformation is information on the residual samples, and may includeinformation on (quantized) transform coefficients for the residualsamples.

The adder (or reconstructor) of the encoding apparatus may generatereconstructed samples (reconstructed picture, reconstructed block, orreconstructed sample array) by adding the residual samples generated bythe residual processor 230 and the prediction samples generated by thepredictor 220.

The entropy encoder 240 of the encoding apparatus may encode imageinformation including the prediction-related information and theinformation on the weighted prediction generated by the predictor 220,the residual information generated by the residual processor 230, andthe like (S920). Here, the information on the weighted prediction mayinclude a flag (hereinafter, “first flag”) relating to whether theweighted prediction is applied to slices referring to a pictureparameter set of the image information, a flag (hereinafter, “secondflag”) relating to whether the information on the weighted predictionexists in a picture header of the image information or in a slice headerof the image information, a prediction weighted table syntax, and thelike. The first flag may include a pps_weighted_pred_flag syntax elementindicating whether the weighted prediction is applied to P or B slicesreferring to the picture parameter set and/or a pps_weighted_bipred_flagsyntax element indicating whether the weighted prediction is applied toB slices referring to the picture parameter set. The second flag may be,for example, weighted_pred_table_present_in_ph_flag, which may beincluded in the picture parameter set when the value of thepps_weighted_pred_flag and/or pps_weighted_bipred_flag syntax elementis 1. When the value of the second flag is 1, the information on theweighted prediction included in the prediction weighted table syntax maynot exist in the slice header referring to the picture parameter set,but may exist in the picture header referring to the picture parameterset. When the value of the second flag is 0, the information on theweighted prediction may not exist in the picture header referring to thepicture parameter set, but may exist in the slice header referring tothe picture parameter set.

The prediction weighted table syntax may be included in the pictureheader or the slice header of the image information based on the valuesof the first flag (pps_weighted_pred_flag and/orpps_weighted_bipred_flag) and the second flag. For example, when boththe value of the first flag and the value of the second flag are 1, theprediction weighted table syntax may be included in the picture header.When the value of the first flag is 1 and the value of the second flagis 0, the prediction weighted table syntax may be included in the sliceheader.

The prediction weighted table syntax may include number information forthe weighted prediction based on the value of the second flag. The valueof the number information may be the same as the number of weightedreference pictures in a reference picture list. Here, the referencepicture list may include an L0 reference picture list and an L1reference picture list. The number information for the weightedprediction may include first number information (num_10weighted_ref_pics) on the L0 reference picture list and second numberinformation (num_10 weighted_ref_pics) on the L1 reference picture list.As shown in Table 29, the first number information and the second numberinformation may be independently parsed from the prediction weightedtable syntax. The number information for the weighted prediction may ormay not be included in the prediction weighted table syntax based onwhether the value of the second flag is 0 or 1. For example, when thevalue of the second flag is 1, the number information for the weightedprediction may be included in the prediction weighted table syntax. Whenthe value of the second flag is 0, the first number information may beinferred as NumRefIdxActive[0], and the second number information may beinferred as NumRefIdxActive[1].

The prediction weighted table syntax may include a syntax element(luma_weight_10_flag) indicating whether weighting factors for L0prediction exist and/or a syntax element (luma_weight_11_flag)indicating whether weighting factors for L1 prediction exist.luma_weight_10_flag may be included in the prediction weighted tablesyntax based on the first number information. luma_weight_11_flag may beincluded in the prediction weighted table syntax based on the secondnumber information. For example, when the value of the first numberinformation is n, n luma_weight_10_flag syntax elements may be includedin the prediction weighted table syntax. Similarly, when the value ofthe second number information is n, n luma_weight_11_flag syntaxelements may be included in the prediction weighted table syntax.

For example, the entropy encoder 240 of the encoding apparatus mayencode the image information based on at least one of Table 5 to Table23 and may output the encoded image information in the form of abitstream. Specifically, when the prediction weighted table syntax isincluded in the picture header of the image information, the entropyencoder 240 of the encoding apparatus may determine the value of thefirst flag (pps_weighted_pred_flag and/or pps_weighted_bipred_flag) andthe value of the second flag (weighted_pred_table_present_in_ph_flag)as 1. When the prediction weighted table syntax is included in the sliceheader of the image information, the entropy encoder 240 of the encodingapparatus may determine the value of the first flag as 1 and maydetermine the value of the second flag as 0. When the predictionweighted table syntax is included in the picture header, all slicesassociated with the picture header in the picture may have the samereference picture list, and when the prediction weighted table syntax isincluded in the slice header, slices associated with the slice headermay have the same reference picture list. The first flag and the secondflag may be included in the picture parameter set of the imageinformation and be transmitted to the decoding apparatus.

The predictor 220 of the encoding apparatus may generate numberinformation on weighted reference pictures in a reference picture listbased on the weighted prediction based on the motion information. Inthis case, the entropy encoder 240 of the encoding apparatus may encodethe image information including the information about the number. Thenumber information may or may not be included in the prediction weightedtable syntax in the image information based on whether the value of theflag is 0 or 1. The value of the number information may be the same asthe number of the weighted reference pictures in the reference picturelist. Therefore, the prediction weighted table syntax may include asmany weighting factor-related flags (luma_weight_10_flag and/orluma_weight_11_flag) as the value of the number information. Forexample, when the value of the number information is n, the predictionweighted table syntax may include n weighting factor-related flags. Thenumber information and/or the weighting factor-related flag may beindependently included for each of L0 and L1 in the prediction weightedtable syntax. In other words, number information on weighted referencepictures in L0 and number information on weighted reference pictures inL1 may be independently signaled in the prediction weighted table syntaxwithout depending on each other (without depending on the number ofactive reference pictures for each list).

FIG. 11 and FIG. 12 schematically illustrate an example of a video/imagedecoding method and related components according to an embodiment of thepresent document.

The video/image decoding method disclosed in FIG. 11 may be performed bythe (video/image) decoding apparatus 300 disclosed in FIG. 3 and FIG. 12. Specifically, for example, S1100 and S1110 of FIG. 11 may be performedby the entropy decoder 310 of the decoding apparatus. S1120 may beperformed by the predictor 330 of the decoding apparatus, and S1130 maybe performed by the adder 340 of the decoding apparatus. The video/imagedecoding method disclosed in FIG. 11 may include the embodimentsdescribed above in this document.

Referring to FIG. 11 and FIG. 12 , the entropy decoder 310 of thedecoding apparatus may parse flags relating to weighted prediction froma picture parameter set of a bitstream (S1100). The flags may include afirst flag relating to whether the weighted prediction is applied toslices referring to the picture parameter set and a second flag relatingto whether information on the weighted prediction exists in a pictureheader of the bitstream or in a slice header of the bitstream. Theentropy decoder 310 of the decoding apparatus may parse a predictionweighted table syntax from the picture header or the slice header basedon the flags (first flag and second flag) (S1110). Here, the first flagmay include a pps_weighted_pred_flag syntax element indicating whetherthe weighted prediction is applied to P or B slices referring to thepicture parameter set and/or a pps_weighted_bipred_flag syntax elementindicating whether the weighted prediction is applied to B slicesreferring to the picture parameter set. The second flag may be parsedbased on the first flag. For example, the second flag may be parsed fromthe picture parameter set when the value of the pps_weighted_pred_flagand/or pps_weighted_bipred_flag syntax element is 1.

When the value of the second flag is 1, the information on the weightedprediction included in the prediction weighted table syntax may notexist in the slice header referring to the picture parameter set, butmay exist in the picture header referring to the picture parameter set.When the value of the second flag is 0, the information on the weightedprediction may not exist in the picture header referring to the pictureparameter set, but may exist in the slice header referring to thepicture parameter set. Therefore, when the value of the first flag andthe value of the second flag are 1, the entropy decoder 310 of thedecoding apparatus may parse the prediction weighted table syntax fromthe picture header of the bitstream. When the value of the first flag is1 and the value of the second flag is 0, the entropy decoder 310 of thedecoding apparatus may parse the prediction weighted table syntax fromthe slice header of the bitstream. When the prediction weighted tablesyntax is parsed from the picture header, all slices associated with thepicture header in the picture may have the same reference picture list,and when the prediction weighted table syntax is parsed from the sliceheader, slices associated with the slice header may have the samereference picture list.

The entropy decoder 310 of the decoding apparatus may parse numberinformation for the weighted prediction from the prediction weightedtable syntax. The value of the number information may be the same as thenumber of weighted reference pictures in a reference picture list. Theentropy decoder 310 of the decoding apparatus may parse as manyweighting factor-related flags (luma_weight_10_flag and/orluma_weight_11_flag) as the value of the number information from theprediction weighted table syntax based on the number information. Forexample, when the value of the second flag is 1, the entropy decoder 310of the decoding apparatus may parse the number information from theprediction weighted table syntax. When the value of the second flag is0, the first number information may be inferred as NumRefIdxActive[0],and the second number information may be inferred as NumRefIdxActive[1].When the value of the number information is n, n weightingfactor-related flags may be parsed from the prediction weighted tablesyntax. The number information and/or the weighting factor-related flagmay be independently included for each of L0 and L1 in the predictionweighted table syntax. In one example, number information on weightedreference pictures in L0 and number information on weighted referencepictures in L1 may be independently parsed in the prediction weightedtable syntax without depending on each other (without depending on thenumber of active reference pictures for each list).

The decoding apparatus may perform weighted prediction on a currentblock in a current picture based on prediction-related information(inter/intra prediction classification information, intra predictionmode information, inter prediction mode information, the information onthe weighted prediction, or the like) obtained from the bitstream,thereby reconstructing the current picture. Specifically, the predictor330 of the decoding apparatus may perform the weighted prediction on thecurrent block based on the syntax elements in the prediction weightedtable syntax, thereby generating prediction samples for the currentblock (S1120). In one example, the predictor 330 of the decodingapparatus may parse the weighting factor-related flags based on thenumber information for the weighted prediction in the predictionweighted table syntax, and may derive weightings for the weightedprediction based on the weighting factor-related flags. For example,when the value of the number information is n, the predictor 330 of thedecoding apparatus may parse n weighting factor-related flags from theprediction weighted table syntax. The predictor 330 of the decodingapparatus may perform the weighted prediction on the current block basedon the weightings, thereby deriving the prediction samples for thecurrent block.

The residual processor 320 of the decoding apparatus may generateresidual samples based on residual information obtained from thebitstream. The adder 340 of the decoding apparatus may generatereconstructed samples based on the prediction samples generated by thepredictor 330 and the residual samples generated by the residualprocessor 320 (S1130). The adder 340 of the decoding apparatus maygenerate a reconstructed picture (reconstructed block) based on thereconstructed samples.

Subsequently, if necessary, an in-loop filtering procedure, such asdeblocking filtering, SAO, and/or ALF, may be applied to thereconstructed picture in order to improve subjective/objective picturequality.

Although methods have been described on the basis of a flowchart inwhich steps or blocks are listed in sequence in the above-describedembodiments, the steps of the present document are not limited to acertain order, and a certain step may be performed in a different stepor in a different order or concurrently with respect to that describedabove. Further, it will be understood by those ordinary skilled in theart that the steps of the flowcharts are not exclusive, and another stepmay be included therein or one or more steps in the flowchart may bedeleted without exerting an influence on the scope of the presentdocument.

The aforementioned method according to the present document may be inthe form of software, and the encoding apparatus and/or decodingapparatus according to the present document may be included in a devicefor performing image processing, for example, a TV, a computer, a smartphone, a set-top box, a display device, or the like.

When the embodiments of the present document are implemented bysoftware, the aforementioned method may be implemented by a module(process or function) which performs the aforementioned function. Themodule may be stored in a memory and executed by a processor. The memorymay be installed inside or outside the processor and may be connected tothe processor via various well-known means. The processor may includeApplication-Specific Integrated Circuit (ASIC), other chipsets, alogical circuit, and/or a data processing device. The memory may includea Read-Only Memory (ROM), a Random Access Memory (RAM), a flash memory,a memory card, a storage medium, and/or other storage device. In otherwords, the embodiments according to the present document may beimplemented and executed on a processor, a micro-processor, acontroller, or a chip. For example, functional units illustrated in therespective figures may be implemented and executed on a computer, aprocessor, a microprocessor, a controller, or a chip. In this case,information on implementation (for example, information on instructions)or algorithms may be stored in a digital storage medium.

In addition, the decoding apparatus and the encoding apparatus to whichthe embodiment(s) of the present document is applied may be included ina multimedia broadcasting transceiver, a mobile communication terminal,a home cinema video device, a digital cinema video device, asurveillance camera, a video chat device, and a real time communicationdevice such as video communication, a mobile streaming device, a storagemedium, a camcorder, a video on demand (VoD) service provider, an OverThe Top (OTT) video device, an internet streaming service provider, a 3Dvideo device, a Virtual Reality (VR) device, an Augment Reality (AR)device, an image telephone video device, a vehicle terminal (forexample, a vehicle (including an autonomous vehicle) terminal, anairplane terminal, or a ship terminal), and a medical video device; andmay be used to process an image signal or data. For example, the OTTvideo device may include a game console, a Blu-ray player, anInternet-connected TV, a home theater system, a smartphone, a tablet PC,and a Digital Video Recorder (DVR).

In addition, the processing method to which the embodiment(s) of thepresent document is applied may be produced in the form of a programexecuted by a computer and may be stored in a computer-readablerecording medium. Multimedia data having a data structure according tothe embodiment(s) of the present document may also be stored in thecomputer-readable recording medium. The computer readable recordingmedium includes all kinds of storage devices and distributed storagedevices in which computer readable data is stored. The computer-readablerecording medium may include, for example, a Blu-ray disc (BD), auniversal serial bus (USB), a ROM, a PROM, an EPROM, an EEPROM, a RAM, aCD-ROM, a magnetic tape, a floppy disk, and an optical data storagedevice. The computer-readable recording medium also includes mediaembodied in the form of a carrier wave (for example, transmission overthe Internet). In addition, a bitstream generated by the encoding methodmay be stored in the computer-readable recording medium or transmittedthrough a wired or wireless communication network.

In addition, the embodiment(s) of the present document may be embodiedas a computer program product based on a program code, and the programcode may be executed on a computer according to the embodiment(s) of thepresent document. The program code may be stored on a computer-readablecarrier.

FIG. 13 represents an example of a contents streaming system to whichthe embodiment of the present document may be applied.

Referring to FIG. 13 , the content streaming system to which theembodiments of the present document is applied may generally include anencoding server, a streaming server, a web server, a media storage, auser device, and a multimedia input device.

The encoding server functions to compress to digital data the contentsinput from the multimedia input devices, such as the smart phone, thecamera, the camcorder and the like, to generate a bitstream, and totransmit it to the streaming server. In another example, in a case inwhich the multimedia input device, such as, the smart phone, the camera,the camcorder or the like, directly generates a bitstream, the encodingserver may be omitted.

The bitstream may be generated by an encoding method or a bitstreamgeneration method to which the embodiments of the present document isapplied. And the streaming server may temporarily store the bitstream ina process of transmitting or receiving the bitstream.

The streaming server transmits multimedia data to the user equipment onthe basis of a user's request through the web server, which functions asan instrument that informs a user of what service there is. When theuser requests a service which the user wants, the web server transfersthe request to the streaming server, and the streaming server transmitsmultimedia data to the user. In this regard, the contents streamingsystem may include a separate control server, and in this case, thecontrol server functions to control commands/responses betweenrespective equipment in the content streaming system.

The streaming server may receive contents from the media storage and/orthe encoding server. For example, in a case the contents are receivedfrom the encoding server, the contents may be received in real time. Inthis case, the streaming server may store the bitstream for apredetermined period of time to provide the streaming service smoothly.

For example, the user equipment may include a mobile phone, a smartphone, a laptop computer, a digital broadcasting terminal, a personaldigital assistant (PDA), a portable multimedia player (PMP), anavigation, a slate PC, a tablet PC, an ultrabook, a wearable device(e.g., a watch-type terminal (smart watch), a glass-type terminal (smartglass), a head mounted display (HMD)), a digital TV, a desktop computer,a digital signage or the like.

Each of servers in the contents streaming system may be operated as adistributed server, and in this case, data received by each server maybe processed in distributed manner.

What is claimed is:
 1. An image decoding method performed by an imagedecoding apparatus, the method comprising: parsing flags related toweighted prediction from a bitstream; parsing a prediction weightedtable syntax from a picture header of the bitstream based on the flags;generating prediction samples for a current block in a current picturebased on syntax elements in the prediction weighted table syntax; andgenerating reconstructed samples based on the prediction samples,wherein the flags comprise a first flag related to whether the weightedprediction is applied to slices referring to a picture parameter set ofthe bitstream and a second flag related to whether information on theweighted prediction is present in the picture header, wherein theinformation on the weighted prediction comprises the prediction weightedtable syntax, wherein the second flag is parsed from the pictureparameter set based on the first flag, wherein the current pictureincludes a plurality of slices, and wherein the prediction weightedtable syntax comprised in the picture header is related to all of theplurality of slices in the current picture referring to the pictureheader.
 2. An image encoding method performed by an image encodingapparatus, the method comprising: generating prediction samples for acurrent block by performing weighted prediction based on motioninformation on the current block in a current picture; generatingresidual information based on the prediction samples and originalsamples of the current picture; and encoding image informationcomprising flags related to the weighted prediction, information on theweighted prediction and the residual information, wherein theinformation on the weighted prediction comprises a prediction weightedtable syntax, wherein the flags comprise a first flag related to whetherthe weighted prediction is applied to slices referring to a pictureparameter set of the image information and a second flag related towhether the information on the weighted prediction is present in apicture header of the image information, wherein the second flag iscomprised in the picture parameter set based on the first flag, whereinthe prediction weighted table syntax is comprised in the picture headerbased on the flags, wherein the current picture includes a plurality ofslices, and wherein the prediction weighted table syntax comprised inthe picture header is related to all of the plurality of slices in thecurrent picture referring to the picture header.
 3. A non-transitorycomputer-readable digital storage medium storing a bitstream generatedby the image encoding method of claim
 2. 4. A transmission method ofdata for an image, the method comprising: Obtaining a bitstream for theimage, wherein the bitstream is generated based on generating predictionsamples for a current block by performing weighted prediction based onmotion information on the current block in a current picture, generatingresidual information based on the prediction samples and originalsamples of the current picture and encoding image information comprisingflags related to the weighted prediction, information on the weightedprediction and the residual information; and transmitting, through atransmitter, the data comprising the bitstream, wherein the informationon the weighted prediction comprises a prediction weighted table syntax,wherein the flags comprise a first flag related to whether the weightedprediction is applied to slices referring to a picture parameter set ofthe image information and a second flag related to whether theinformation on the weighted prediction is present in a picture header ofthe image information, wherein the second flag is comprised in thepicture parameter set based on the first flag, wherein the predictionweighted table syntax is comprised in the picture header based on theflags, wherein the current picture includes a plurality of slices, andwherein the prediction weighted table syntax comprised in the pictureheader is related to all of the plurality of slices in the currentpicture referring to the picture header.